4 条题解

  • 0
    @ 2025-4-9 21:05:10

    #include <bits/stdc++.h> using namespace std;

    int main(){ ** int n,a,b,c,x,y,z,m;** ** x=0;** ** y=0;** ** z=0;** ** cin>>n;** ** for(int i=0;i<n;i++){** ** cin>>a>>b>>c;** ** x=x+a;** ** y=y+b;** ** z=z+c;** ** } ** m=x+y+z; ** cout<<x<<" "<<y<<" "<<z<<" "<<m;** ** return 0;** }

    • 0
      @ 2025-1-31 21:08:14
      #include<bits/stdc++.h>
      using namespace std;
      int main(){
      	int n,jp,yp,tp,jps=0,yps=0,tps=0;
      	cin>>n;
      	for(int i=1;i<=n;i++)
      	{
      	 cin>>jp>>yp>>tp;
      	 jps=jps+jp;
      	 yps=yps+yp;
      	 tps=tps+tp;
      	} 
      	cout<<jps<<" "<<yps<<" "<<tps<<" ";
      	cout<<jps+yps+tps;
      	return 0;
      }
      
      • 0
        @ 2025-1-19 13:08:14

        #include <bits/stdc++.h>

        using namespace std;

        int main(){

        int n;
        
        int sum,a[20][3]={0};
        
        int i;
        
        cin>>n;
        
        for(i=1;i<=n;i++)
        
        {
        
        	cin>>a[i][0]>>a[i][1]>>a[i][2];
        
        	a[0][0]+=a[i][0];
        
        	a[0][1]+=a[i][1];
        
        	a[0][2]+=a[i][2];
        
        }
        
        sum=a[0][0]+a[0][1]+a[0][2];
        
        cout<<a[0][0]<<" "<<a[0][1]<<" "<<a[0][2]<<" "<<sum;
        
        return 0;
        

        } 二维数组

        • 0
          @ 2025-1-19 11:10:48
          #include<bits/stdc++.h>
          using namespace std;
          int main () {
              int n;
              cin >> n;
              int j,y,t;
              int jz = 0,yz = 0,tz = 0;
              
              for(int i = 0;i < n;i++){
                  cin >> j >> y >> t;//输入金,银,铜牌数量
                  jz+=j;
                  yz+=y;
                  tz+=t;
              }
              
              cout << jz << ' ' << yz << ' ' << tz << ' ' << jz + yz + tz;
              return 0;
          }
          
          • 1

          信息

          ID
          55
          时间
          1000ms
          内存
          128MiB
          难度
          2
          标签
          (无)
          递交数
          99
          已通过
          60
          上传者