日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

B - Greg's Workout CodeForces - 255A(思维)

發布時間:2023/12/15 编程问答 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 B - Greg's Workout CodeForces - 255A(思维) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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.

Examples
Input
2
2 8
Output
biceps
Input
3
5 1 10
Output
back
Input
7
3 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.

大水題一道,不多解釋,代碼給上:

#include<iostream> #include<cmath> #include<algorithm> #include<cstdio> using namespace std;int n;int main() {while(cin>>n){int a=0,b=0,c=0;int x;for(int i=1;i<=n;i++){cin>>x;if(i%3==1) a+=x;else if(i%3==2) b+=x;else if(i%3==0) c+=x;}int y=max(a,max(b,c));if(y==a) cout<<"chest"<<endl;else if(y==b) cout<<"biceps"<<endl;else if(y==c) cout<<"back"<<endl;} }

努力加油a啊,(o)/~

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的B - Greg's Workout CodeForces - 255A(思维)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。