7 条题解

  • 1
    @ 2023-4-8 8:43:25
    #include<iostream> 
    using namespace std;
    int main()
    {
    	int a[1001],n,j,k=0;
    	for(int i=1;i<=1000;i++)
    	{
    		a[i]=0;
    	}
    	cin>>n;
    	for(int i=1;i<=n;i++)
    	{
    		cin>>j;
    		a[j]++;
    	}
    	for(int i=1;i<=1000;i++)
    	{
    		if(a[i]>=1)
    		{
    			k++;
    		}
    	}
    	cout<<k<<endl;
    	for(int i=1;i<=1000;i++)
    	{
    		if(a[i]>=1)
    		{
    			cout<<i<<" ";
    		}
    	}
    	return 0;
    }
    
    • 1
      @ 2023-3-14 19:21:37
      #include<bits/stdc++.h>
      using namespace std;
      int a[101]={0,6,3,1,7,5,8,9,2,4},b[101],k,l=9,h=1; 
      int main() 
      { 
          while(1) 
      	{ 
      	    k++;
      		if(k%2==0)
      		{
      			a[l]=a[1];
      			for(int i=2;i<=l;i++)
      			{
      				a[i-1]=a[i];
      			}
      		} 
      		else
      		{
      		    l-1;
      		    b[h]=a[1];
      			for(int i=2;i<=l;i++)
      			{
      				a[i-1]=a[i];
      			}
      			h++;	
      		}
      	} 
      	for(int i=1;i<=9;i++)
      	{
      		cout<<b[i]<<" ";
      	}
      	return 0; 
      }
      
      • 1
        @ 2023-3-14 19:01:03

        #include<bits/stdc++.h> using namespace std; int a[101]={6,3,1,7,5,8,9,2,4},b[101],k; int main() { while(1) { k++; } return 0; }

        • 0
          @ 2023-3-14 19:22:21
          #include<bits/stdc++.h>
          using namespace std;
          int a[101]={0,6,3,1,7,5,8,9,2,4},b[101],k,l=9,h=1; 
          int main() 
          { 
              while(1) 
          	{ 
          	    k++;
          		if(k%2==0)
          		{
          			a[l]=a[1];
          			for(int i=2;i<=l;i++)
          			{
          				a[i-1]=a[i];
          			}
          		} 
          		else
          		{
          		    l-1;
          		    b[h]=a[1];
          			for(int i=2;i<=l;i++)
          			{
          				a[i-1]=a[i];
          			}
          			h++;	
          		}
          	} 
          	for(int i=1;i<=9;i++)
          	{
          		cout<<b[i]<<" ";
          	}
          	return 0; 
          }
          
          • 0
            @ 2023-2-25 9:28:19
            题解 - 【入门】明明的随机数 - Hydro body { --font-family: "Microsoft Yahei", "Open Sans", "Seravek", "Segoe UI", "Verdana", "PingFang SC", "Hiragino Sans GB", "Lantinghei SC", "Microsoft Yahei", "WenQuanYi Micro Hei", "sans"; --code-font-family: "Ubuntu Mono", "monaco", "Source Code Pro", "Consolas", "Lucida Console", "monospace"; --font-ligatures: none !important; } #panel { display: flex; flex-direction: column; }

            3 条题解

            • 0
              唐宇喆 (tyz) LV 5
                  </div>
                </div>
                <div class="hasjs--hide">
                  <form method="post" class="dczcomments__box" name="dczcomments__box__form" data-hotkey="ctrl+enter:submit,esc:vjCommentBoxCancel">
                    <div>
                      <textarea name="content" class="textbox" data-markdown required></textarea>
                    </div>
                    <div>
                      <input type="submit" class="rounded primary button dczcomments__box__submit" value="分享 (Ctrl+Enter)" data-value-reply="回复 (Ctrl+Enter)" data-value-comment="分享 (Ctrl+Enter)" data-value-comment-update="更新 (Ctrl+Enter)" data-value-reply-update="更新 (Ctrl+Enter)">
                      <input type="button" class="rounded button nojs--hide" name="dczcomments__box__cancel" value="取消 (Esc)">
                    </div>
                    <input type="hidden" name="operation" value="submit">
                  </form>
                </div>
                <div class="nojs--hide">
                  <textarea class="textbox" name="dczcomments__dummy-box" readonly data-form="{&quot;operation&quot;:&quot;submit&quot;}" placeholder="发表您的题解"></textarea>
                </div>
                <div class="commentbox-placeholder"></div>
                <ul style="display:none">
                  <li class="dczcomments__reply commentbox-container">
                    <div class="media">
                      <div class="media__body top">
                        <div class="clearfix">
                          <div class="supplementary dczcomments__supplementary">
                            <span class="user-profile-link">
                <img class="small user-profile-avatar v-center" loading="lazy" src="//cn.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=mm&amp;s=64" width="20" height="20">
              <a class="user-profile-name" href="/user/172">
                    唐宇喆 (tyz)
                </a>
              
              </span>
                          </div>
                        </div>
                        <div class="commentbox-placeholder"></div>
                      </div>
                    </div>
                  </li>
                </ul>
              </div>
              
              </li>
            • 0
              彭姚博 (15215179605) LV 4 @ 2023-2-25 1:24:52

              #include<bits/stdc++.h> using namespace std; int n,g,x=0,b[105]; bool s[1005]; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>g; s[g]=1; } for(int i=1;i<=1000;i++)if(s[i]==1){ x++; b[x]=i; } cout<<x<<endl; for(int i=1;i<=x;i++)cout<<b[i]<<" "; return 0; }

                </div>
                <div class="commentbox-edit-target"></div>
                <ul class="dczcomments__replies commentbox-reply-target"></ul>
              </div>
              
              </li>
            • 0
              路滨南 (13983950916) LV 7 @ 2023-2-14 11:10:34
              using namespace std;
              int n,g,x=0,b[105];
              bool s[1005];
              int main(){
              	cin>>n;
              	for(int i=1;i<=n;i++){
              		cin>>g;
              		s[g]=1;			
              	}
              	for(int i=1;i<=1000;i++)if(s[i]==1){
              		x++;
              		b[x]=i;
              	}
              	cout<<x<<endl;
              	for(int i=1;i<=x;i++)cout<<b[i]<<" ";
              }
              
                </div>
                <div class="commentbox-edit-target"></div>
                <ul class="dczcomments__replies commentbox-reply-target"></ul>
              </div>
              
              </li>
            • -2
              杨周子 (13883626035) LV 4 @ 2023-2-25 1:24:19

              #include<bits/stdc++.h> using namespace std; int n,g,x=0,b[105]; bool s[1005]; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>g; s[g]=1; } for(int i=1;i<=1000;i++)if(s[i]==1){ x++; b[x]=i; } cout<<x<<endl; for(int i=1;i<=x;i++)cout<<b[i]<<" "; }

                </div>
                <div class="commentbox-edit-target"></div>
                <ul class="dczcomments__replies commentbox-reply-target"></ul>
              </div>
              
              </li></ul>
                              <ul class="pager pager-bottom"><li>
                    <span class="pager__item current">1</span>
                  </li></ul>
              
                              </div>
              </div>
                </div>
              

              【入门】明明的随机数

              信息

              ID
              761
              时间
              1000ms
              内存
              256MiB
              难度
              5
              标签
              递交数
              49
              已通过
              19
              上传者
              mzh
        • 0
          @ 2023-2-25 9:24:52

          #include<bits/stdc++.h> using namespace std; int n,g,x=0,b[105]; bool s[1005]; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>g; s[g]=1; } for(int i=1;i<=1000;i++)if(s[i]==1){ x++; b[x]=i; } cout<<x<<endl; for(int i=1;i<=x;i++)cout<<b[i]<<" "; return 0; }

          • -4
            @ 2023-2-25 9:24:19

            #include<bits/stdc++.h> using namespace std; int n,g,x=0,b[105]; bool s[1005]; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>g; s[g]=1; } for(int i=1;i<=1000;i++)if(s[i]==1){ x++; b[x]=i; } cout<<x<<endl; for(int i=1;i<=x;i++)cout<<b[i]<<" "; }

            • 【入门】明明的随机数

              信息

              ID
              761
              时间
              1000ms
              内存
              256MiB
              难度
              6
              标签
              递交数
              85
              已通过
              23
              上传者