Codeforces Round #156 (Div. 2) --- A. Greg & #39; s Workout,

Source: Internet
Author: User

Codeforces Round #156 (Div. 2) --- A. Greg's Workout,

Greg's Workout
Time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Greg is a beginner bodybuilder. Today the gym coach gave him the training plan. All it had wasNIntegersA1, bytes,A2, middle..., middle ,...,AN. These numbers mean that Greg needs to do exactlyNExercises today. Besides, Greg shoshould repeatI-Th in order exerciseAITimes.

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 th one is "biceps", and so on toN-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 integerN(1 digit ≤ DigitNLimit ≤ Limit 20). The second line containsNIntegersA1, bytes,A2, middle..., middle ,...,AN(1 digit ≤ DigitAILimit ≤ limit 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.






Solution: water problems. Scan all the data to calculate the total number of times of each exercise and find the type of exercise corresponding to the maximum among the three.







AC code:

#include <iostream>#include <cstdio>#include <algorithm>using namespace std;int main(){//freopen("in.txt","r",stdin);int n, k;while(cin>>n){int x = 0, xx = 0, xxx = 0;for(int i=1; i<=n; i++){cin>>k;if(i%3==1)  x += k;else if(i%3==2)  xx += k;else  xxx += k;}int t = max(x, max(xx, xxx));if(x == t)  cout<<"chest"<<endl;else if(xx == t)  cout<<"biceps"<<endl;else  cout<<"back"<<endl;}return 0;}





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.