Time limit: 1000 ms Memory limit: 65536 KB
Submissions: 17424 Passes: 12084
[Title description]
In the 2008 Beijing Olympic Games, athletes from country A participated in the finals of n days (1≤n≤17). Now we need to count the number of gold, silver, bronze and total medals won by country A. Enter the first line is the number of days in country A to participate in the finals n, followed by n lines, each line is the number of gold, silver, and bronze medals won by the country in a certain day. Output 4 integers, which is the total number of gold, silver and bronze medals and total medals won by country A.
[Input]
Enter n + 1 lines. The first line is the number of days in country A participating in the finals, and the next n lines. Each line is the number of gold, silver, and bronze medals won by the country in a day, separated by a space.
[Output]
Output 1 line, including 4 integers, which is the total number of gold, silver and bronze medals and total medals won by country A, separated by a space.
[Sample input]
3
1 0 3
3 1 0
0 3 0
[Sample output]
4 4 3 11
[Source]
No
代码如下: #include<iostream> using namespace std; int main(){ int n,jp=0,yp=0,tp=0; cin>>n; for (int i=1,x,y,z; i<=n; i++){ cin>>x>>y>>z; jp += x; yp += y; tp += z; } cout<<jp<<" "<<yp<<" "<<tp<<" "<<jp+yp+tp<<endl; return 0; }
NOIP video address
https://pan.baidu.com/s/1fAuVscWNdApIGmKZK4Wb6Q
extraction code: u56x