fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n,gold=0,silver=0,bronze=0,sum=0,i;
  5. scanf("%d",&n);
  6. for(i=1;i<=n;i++){
  7. int g,s,b;
  8. scanf("%d %d %d",&g,&s,&b);
  9. gold+=g;
  10. silver+=s;
  11. bronze+=b;
  12. }
  13. sum=gold+silver+bronze;
  14. printf("%d %d %d %d",gold,silver,bronze,sum);
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5268KB
stdin
3
1 0 3
3 1 0
0 3 0
stdout
4 4 3 11