codeforces 156 Div2 A

mac2022-06-30  79

A. Greg's Workout time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output

Greg is a beginner bodybuilder. Today the gym coach gave him the training plan. All it had was n integers a1, a2, ..., an. These numbers mean that Greg needs to do exactly n exercises today. Besides, Greg should repeat the i-th in order exercise ai times.

Greg now only does three types of exercises: "chest" exercises, "biceps" exercises and "back" exercises. Besides, his training is cyclic, that is, the first exercise he does is a "chest" one, the second one is "biceps", the third one is "back", the fourth one is "chest", the fifth one is "biceps", and so on to the n-th exercise.

Now Greg wonders, which muscle will get the most exercise during his training. We know that the exercise Greg repeats the maximum number of times, trains the corresponding muscle the most. Help Greg, determine which muscle will get the most training.

Input

The first line contains integer n (1 ≤ n ≤ 20). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 25) — the number of times Greg repeats the exercises.

Output

Print word "chest" (without the quotes), if the chest gets the most exercise, "biceps" (without the quotes), if the biceps gets the most exercise and print "back" (without the quotes) if the back gets the most exercise.

It is guaranteed that the input is such that the answer to the problem is unambiguous.

Sample test(s) input 22 8 output biceps input 35 1 10 output back input 73 3 2 7 9 6 8 output chest Note

In the first sample Greg does 2 chest, 8 biceps and zero back exercises, so the biceps gets the most exercises.

In the second sample Greg does 5 chest, 1 biceps and 10 back exercises, so the back gets the most exercises.

In the third sample Greg does 18 chest, 12 biceps and 8 back exercises, so the chest gets the most exercise.

 

水题,直接累加比大小。

附代码:

1 #include<iostream> 2 using namespace std; 3 4 int ans[3]={0}; 5 6 int main(void) 7 { 8 int i, n, m; 9 cin>>n; 10 for( i=0; i<n; i++) 11 { 12 cin>>m; 13 if( i%3==0) 14 ans[0]+=m; 15 if( i%3==1) 16 ans[1]+=m; 17 if( i%3==2) 18 ans[2]+=m; 19 } 20 if( ans[0] > ans[1] && ans[0] > ans[2]) 21 cout<<"chest"<<endl; 22 if( ans[1] > ans[0] && ans[1] > ans[2]) 23 cout<<"biceps"<<endl; 24 if( ans[2] > ans[0] && ans[2] > ans[1]) 25 cout<<"back"<<endl; 26 return 0; 27 }

 

转载于:https://www.cnblogs.com/shadow-justice/archive/2013/01/19/2867906.html

最新回复(0)