008: Olympic medal count

 

Total time limit: 
1000ms
 
Memory Limit: 
65536kB
description

2008 Beijing Olympic Games, the athletes participated n A national day of finals (1≤n≤17). Now statistics about the number of gold, silver, bronze and total medals A number of countries obtained.

Entry
Enter row n + 1, Line 1 A country is involved in the final project the number of days n, followed by n lines, each line is the number of gold, silver and bronze medals obtained in the country one day, separated by a space.
Export
An output line, comprising four integer gold country A is obtained, silver, bronze, and the total number of the total number of medals, separated by a space.
Sample input
3
1 0 3
3 1 0
0 3 0
Sample Output
4 4 3 11
 1 #include <iostream>
 2 
 3 using namespace std;
 4 int main (){
 5     int n,a,b,c;
 6     int jp[4]={0,0,0,0};
 7     cin>>n;
 8     for(int i=0;i<n;i++){
 9         cin>>a>>b>>c;
10         jp[0]+=a;
11         jp[1]+=b;
12         jp[2]+=c;
13     }
14 
15     cout<<jp[0]<<" "<<jp[1]<<" "<<jp[2]<<" "<<jp[0]+jp[1]+jp[2];
16     return  0;
17 }

 

Guess you like

Origin www.cnblogs.com/geyang/p/12330731.html