CodeForces
来源:互联网 发布:表格相同时间数据提取 编辑:程序博客网 时间:2024/05/11 02:00
CodeForces - 255A
wwl 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 wwl needs to do exactly n exercises today. Besides, wwl should repeat the i-th in order exercise ai times.
wwl 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 wwl wonders, which muscle will get the most exercise during his training. We know that the exercise wwl repeats the maximum number of times, trains the corresponding muscle the most. Help wwl, 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 wwl 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.
Example
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 (You Will Win)
In the first sample wwl does 2 chest, 8 biceps and zero back exercises, so the biceps gets the most exercises.
In the second sample wwl does 5 chest, 1 biceps and 10 back exercises, so the back gets the most exercises.
In the third sample wwl does 18 chest, 12 biceps and 8 back exercises, so the chest gets the most exercise.
#include <cstdio>#include <algorithm>#include <iostream>using namespace std;int main(){ int n,m; scanf("%d",&n); int count1=0,count2=0,count3=0; for (int i=1;i<=n;i++){ scanf("%d",&m); if (i%3==0){ count1+=m; } else if (i%3==1){ count2+=m; } else{ count3+=m; } } int k=max(count1,count3); int xx=max(k,count2); if (xx==count2){ printf("chest\n"); } else if (xx==count3){ printf("biceps\n"); } else{ printf("back\n"); } return 0;}
- codeforces~~~
- Codeforces
- codeforces
- Codeforces
- codeforces
- codeforces
- Codeforces
- Codeforces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- 文字超过1行、2行或者规定的行数,文字自动加省略号
- C#开发微信门户及应用(46)-基于Bootstrap的微信门户应用管理系统功能介绍
- 1.Windows核心编程-基础知识
- POJ 2155 Matrix(二维树状数组+数组数组区间更新+单点查询)
- Java使用jbarcode生成条形码
- CodeForces
- centos7 Qt5.9.1 opencv静态库报grfmt_exr.cpp错误
- select函数(C语言)
- 无法完成请求,因为文件格式模块不能解析,PS新手们是否遇到呢?
- django设置debug设为False静态文件404
- canvas绘制时钟
- Application中方法被执行多次??进程 -- 服务的坑 !!!
- rtp协议分析
- JSON解析的几种方式