#include<bits/stdc++.h> using namespace std; int main() { int a,b,c,d,e=0,f=0,g=0; cin>>a; for(int i=0;i<a;i++) { cin>>b>>c>>d; e+=b; f+=c; g+=d; } cout<<e<<" "<<f<<" "<<g<<" "<<e+f+g; return 0; }
#include<bits/stdc++.h> using namespace std; int n,y,j,t,x,p,z; int main() { for(int i=1;i<=n;i++) { cin>>x>>p>>z; j+=x; y+=p; t+=z; } cout<<j<<" "<<y<<" "<<t<<" "<<j+y+t; return 0;//仅供参考 }
注册一个 安阳中心OJ 通用账户,您就可以在我们提供的所有在线评测服务上提交代码、参与讨论。
使用您的 安阳中心OJ 通用账户