68 938
37 7 59 31 29 23 21 0 49 18 33 45 17 5 38 61 64 15 43 54 64 35 22 45 4 11 53 10 4 54 33 64 42 19 17 46 48 14 32 12 38 61 4 49 46 57 50 15 55 57 61 20 44 29 1 8 61 1 30 9 53 5 25 54 61 19 0 63 24 11 5 33 43 9 54 59 0 44 42 16 11 29 35 19 8 47 51 51 37 1 46 60 2 63 3 33 57 43 21 27 13 54 51 15 48 56 12 56 9 20 44 20 36 2 50 42 6 26 13 22 66 15 13 29 8 61 10 42 30 0 51 61 30 48 6 50 10 19 35 45 54 0 5 18 50 4 65 26 23 59 42 63 36 21 26 51 64 8 47 10 4 5 17 4 29 60 57 32 27 26 32 26 28 51 23 20 53 59 27 49 33 48 47 2 7 27 0 29 52 52 17 20 34 58 4 24 47 66 8 37 35 56 56 46 30 6 47 18 13 53 56 44 59 67 11 53 10 28 42 4 42 23 44 38 49 45 65 48 16 19 18 52 8 44 7 40 43 51 32 27 24 18 21 1 31 49 24 45 27 49 10 59 48 7 29 47 39 30 2 24 9 16 22 3 46 57 8 20 47 7 46 3 34 34 50 18 50 12 39 59 14 57 26 44 31 33 35 49 34 32 23 36 20 26 36 31 2 16 0 34 20 33 32 42 59 61 46 33 14 65 12 4 64 56 58 58 8 55 14 39 10 20 33 16 57 3 24 14 5 16 35 50 63 40 46 29 0 37 58 53 31 16 46 7 13 15 62 3 30 65 45 28 21 51 14 42 59 5 66 36 10 39 16 35 64 60 24 37 30 1 17 33 55 34 27 67 38 65 50 47 54 40 16 13 18 4 27 16 37 18 45 27 13 9 49 65 60 46 0 58 56 9 13 61 22 20 40 54 57 9 50 38 60 63 55 55 20 47 17 36 22 28 31 45 15 1 59 31 55 17 53 19 39 66 6 34 45 3 21 57 5 13 21 25 8 15 1 31 12 49 42 16 59 21 7 28 65 49 50 36 63 6 17 23 26 28 56 58 35 8 9 11 58 51 41 58 29 24 26 25 61 35 42 38 22 54 15 50 29 62 58 47 31 15 30 54 12 48 53 42 39 3 50 16 42 17 55 44 24 45 45 33 26 61 23 19 63 32 23 20 0 17 57 22 36 66 36 36 27 39 29 55 67 10 1 44 64 11 6 50 52 25 18 25 22 37 19 41 66 28 46 30 44 31 31 38 51 20 10 36 54 11 45 22 61 4 5 54 22 60 56 41 49 15 67 61 23 57 30 2 47 54 53 36 46 19 45 30 5 43 65 20 15 19 2 23 54 47 33 11 22 12 34 56 43 62 25 51 55 64 0 56 57 39 65 58 33 30 55 45 46 64 37 30 44 27 22 28 33 39 15 49 24 26 42 12 43 59 55 26 14 12 1 27 65 50 21 57 58 41 60 51 67 8 29 31 46 3 54 7 58 19 42 40 40 64 15 13 36 49 49 57 45 41 22 40 63 3 26 3 63 48 56 65 53 11 62 10 17 61 7 36 51 35 16 31 10 9 62 50 0 0 38 30 42 29 11 29 5 14 54 36 32 63 58 59 46 67 54 15 5 48 15 55 39 55 64 30 9 42 45 9 21 48 57 42 18 62 64 23 36 46 57 47 5 33 36 33 3 8 30 4 6 53 17 9 47 62 35 18 10 24 48 41 27 39 45 51 12 46 22 21 34 17 5 62 19 42 52 52 6 54 16 41 11 61 44 16 22 65 42 10 23 59 50 12 35 20 20 33 6 41 62 11 59 39 35 19 21 3 42 35 11 36 22 46 24 21 59 25 47 47 45 45 64 65 25 67 52 14 38 6 46 66 59 10 58 40 21 27 17 26 31 18 62 2 64 59 30 10 0 6 19 19 21 3 48 6 13 15 44 51 55 44 6 12 30 57 24 62 4 56 58 20 63 4 60 13 23 0 31 39 36 17 18 12 19 15 27 41 50 9 64 51 4 12 14 4 3 9 2 30 45 28 62 51 1 66 24 16 64 15 40 57 17 52 42 47 18 19 13 13 31 40 16 36 5 53 52 55 24 40 16 63 26 23 55 38

7 条评论

  • @ 2026-2-27 11:11:58
    #include <bits/stdc++.h>
    using namespace std;
    int a[105];
    int main(){
        int n,cnt = 0;
        
        cin >> n;
    
        for(int i = 1;i <= n;i++){
            cin >> a[i];
        }
        while(1){
        		int maxn =  n ,minn = a[1];
            for(int i = 1;i <= n;i++){
                if(a[i] > a[maxn]) maxn = i;
                if(a[i] < minn && a[i] != 0) minn = a[i];
            }
            cout<< a[maxn] << endl;
    		if(a[maxn] == 0){
    			break;
    		}
            a[maxn] -= minn;
            cnt++;
        }
        cout << cnt;
        return 0;
    }
    
    • @ 2026-1-24 11:44:20

      二维动态规划(DP)

      #include <bits/stdc++.h>
      using namespace std;
      
      int main() {
      	int arr[100][100]={
      		{9,0,0,0},
      		{12,15,0,0},
      		{10,6,8,0},
      		{2,18,9,5}
      	};
      	
      	//1 定义状态 :dp[x][y] 到x行y列前的最优解
      	int dp[100][100]={0};
      	//2 初始化:最后一行节点
      	for(int i=0;i<=3;i++){
      		dp[3][i] = arr[3][i];
      	}
      	
      	//3状态转移方程:前一行 和前一行的旁边一行的 元素 的最大值 + arr[i][j]
      	//	dp[x][y] += max(dp[x+1][y],dp[x+1][y+1]) + arr[x][y]
      	
      	//4遍历求解
      	for(int x=2;x>=0;x--){
      		for(int y=0;y<=3;y++){
      			dp[x][y] += max(dp[x+1][y],dp[x+1][y+1]) + arr[x][y];
      		}
      	}
      	
      	//输出最优解自底向上的路径中的最优解(最大值)
      	cout << dp[0][0];
      	return 0;
      }
      
      • @ 2026-1-24 11:15:43
        #include <bits/stdc++.h>
        using namespace std;
        
        int main() {
        	int arr[100][100]={
        		{9,0,0,0},
        		{12,15,0,0},
        		{10,6,8,0},
        		{2,18,9,5}
        	};
        	
        	//dp[x][y] 到x行y列前的最优解
        	int dp[100][100]={0};
        	
        	//状态转移方程:
        //	dp[x][y] = max(dp[x+1][y],dp[x+1][y+1]) 
        	
        	//遍历求解
        	for(int i=0;i<=3;i++){
        		for(int j=0;j<=3;j++){
        			dp[x][y] += max(dp[x+1][y],dp[x+1][y+1]) 
        		}
        	}
        	
        	//输出最优解自底向上的路径中的最优解(最大值)
        	cout << dp[0][0];
        	return 0;
        }
        
        • @ 2026-1-18 22:46:51

          8题(改)

          #include<bits/stdc++.h>
          using namespace std;
          struct Student {
            int d;
            int e;
            int a;
          }n[100000];
          int m,k,p,g=1000000,u,t,f,q=1;
          int main(){
          	cin>>p;
              for(int i=0;i<p;i++)cin>>n[i].d>>n[i].e>>n[i].a;
              for(int i=0;i<p;i++){
                  if(n[i].e<g)g=n[i].e;
                  if(n[i].e>f)f=n[i].e;
                  if(n[i].a>k)k=n[i].a;
              }
              for(int i=0;i<p;i++){
                  m=g;
                  if(m>f)break;
                  for(int j=0;j<p;j++){
                  if(n[j].e==m){
                      q=1;
                      if(n[j].a>g)g=n[j].a;
                  }else if(n[j].e==m+1&&g==m){
                      q=0;
                      if(n[j].a>g)g=n[j].a;
                  }
                  }
                  u++;
                  if(q)t+=g-m;
                  else t+=g-m-1;
              }
          	cout<<u<<"\n"<<t;
          	return 0;
          }
          
          
          • @ 2026-1-18 16:52:30

            8题

            #include<bits/stdc++.h>
            using namespace std;
            struct Student {
              int d;
              int e;
              int a;
            }n[100000];
            int m,k,p,g=1000000,u,t,f;
            int main(){
            	cin>>p;
                for(int i=0;i<p;i++)cin>>n[i].d>>n[i].e>>n[i].a;
                for(int i=0;i<p;i++){
                    if(n[i].e<g)g=n[i].e;
                    if(n[i].e>f)f=n[i].e;
                    if(n[i].a>k)k=n[i].a;
                }
                for(int i=0;i<p;i++){
                    m=g;
                    if(m>f)break;
                    for(int j=0;j<p;j++){
                    if(n[j].e==m){
                        if(n[j].a>g)g=n[j].a;
                    }
                    }
                    u++;
                    t+=g-m;
                }
            	cout<<u<<"\n"<<t;
            	return 0;
            }
            
            • @ 2026-1-18 11:45:41
              		
              #include<bits/stdc++.h>
              using namespace std;
              bool cmp(string c,string b) {
              	if(c.size()!=b.size())return c.size()>b.size(); 
              	return c>b;
              }
              int arr[100000],brr[1000000],e,t,c[1000000],d;
              int main() {
              	string a,b;
              	cin>>a>>b;
              	if(!cmp(a,b)) {
              		cout<<"-";
              		swap(a,b);
              	}
              	int lena=a.size(),lenb=b.size(),y=max(lenb,lena);
              	for(int i=0; i<lena; i++)arr[i]=a[lena-1-i]-'0';
              	for(int i=0; i<lenb; i++)brr[i]=b[lenb-1-i]-'0';
              	for(int i=0; i<y; i++) {
              		t=arr[i]-e;
              		if(t-brr[i]<0) {
              			e=1;
              			t+=10;
              		} else {
              			e=0;
              		}
              		c[i]=t-brr[i];
              	}
              	for(int i=y-1; i>=0; i--){
              		if(c[i]!=0){
              		d=i;
              		break;
              	}
              	}
              	for(int i=d; i>=0; i--)cout<<c[i];
              	return 0;
              }
              
              • @ 2026-1-18 11:45:04

                提交

                #include<bits/stdc++.h>
                using namespace std;
                bool cmp(string a,string b){
                	if(a.size()>b.size()){
                		return 1;
                	}else if(a.size()<b.size()){
                		return 0;
                	}else{
                		return (a>b);
                	}
                }
                int a1[1000000001];
                int b1[1000000001];
                int c[100000000001];
                int main(){
                	string a;
                	string b;
                
                	cin>>a>>b;
                
                	if(!cmp(a,b)){
                		cout<<'-';
                		swap(a,b);
                	}
                	int len1 = a.size();
                	int len2 = b.size();
                	for(int i=0;i<len1;i++){
                		a1[i]=a[len1-i-1]-'0';
                	}
                	for(int i=0;i<len2;i++){
                		b1[i]=b[len1-i-1]-'0';
                	}
                	int borrow = 0;
                	for(int i=0;i<=len1;i++){
                		int temp = a1[i] - borrow;
                		if(temp<b1[i]){
                			borrow = 1;
                			temp += 10;
                		}else{
                			borrow = 0;
                		}
                		c[i] = temp - b1[i];
                	}
                	for(int i=0;i<len1;i++){
                		cout<<c[len1-i-1];
                	}
                	return 0;
                }
                
                • 1