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
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.

解题思路:水题。把全部数据扫一遍。直接计算每种锻炼相应的总次数,找出三者中的最大值所相应的锻炼种类。

AC代码:

#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;
}

Codeforces Round #156 (Div. 2)---A. Greg&#39;s Workout的更多相关文章

  1. Codeforces Round #179 (Div. 1) A. Greg and Array 离线区间修改

    A. Greg and Array Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/295/pro ...

  2. Codeforces Round #156 (Div. 2)

    A. Greg's Workout 模3求和,算最大值. B. Code Parsing 最后左半部分为x,右半部分为y,那么从中间不断去掉xy,直到其中一种全部消去. C. Almost Arith ...

  3. 【打CF,学算法——三星级】Codeforces Round #313 (Div. 2) C. Gerald&#39;s Hexagon

    [CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/C 题面: C. Gerald's Hexagon time limit per tes ...

  4. Codeforces Round #313 (Div. 2) C. Gerald&#39;s Hexagon(补大三角形)

    C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  5. Codeforces Round #313 (Div. 2) 560C Gerald&#39;s Hexagon(脑洞)

    C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  6. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  7. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  8. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  9. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

随机推荐

  1. nc命令 (NetCat)

    摘自http://www.68idc.cn/help/server/linux/2014040682705.html NetCat,在网络工具中有"瑞士军刀"美誉,其有Window ...

  2. MPreview.js

    Word,PPT 文档预览组件(图片预览组件) 移动端请移步 MPreview.mobile Demo参考 http://demo.webjyh.com/MPreview/ 特此说明 此插件是我在项目 ...

  3. webpack构建具备版本管理能力的项目

    webpack是时下十分流行的编译和打包工具,它提供一种可扩展的loader的方式,简单的配置,便可以编译打包各类型的文件,包括js.css.image.font.html,以及各种预编译语言都不在话 ...

  4. 关于JS 对象与JSON对象

    Js对象 格式 : //var dataStr = '{ code: 1, msg: "修改成功", read: 1 }'; 序列化字符串为js对象: var p = eval(& ...

  5. css系列教程--margin padding column(完结)

    margin/margin-left/margin-right/margin-top/margin-bottom设置边距属性margin:0;--所有外边距0margin:0 1px;--margin ...

  6. 单击事件的处理方式及注册窗体的创建之(四)Intent实现界面跳转传值

    跳转开发步骤: 创建Intent对象  设置Intent对象的跳转路径  启动Intent //Register_Activity.java case R.id.btnRegister: Inte ...

  7. 你想不到的IT运维前途

    本人一毕业就走上了IT系统运维的道路,我之所以踏上这条路并一直坚持了下来,因为觉得运维工作并非一味关注技术,而是关注包括技术在内的更综合的解决方案,也就是说,做运维,自己要学的知识面更广,考虑问题要更 ...

  8. BlazeDS简介(转自openkk的日志)

    BlazeDS 是一个基于服务器的 Java 远程控制 (remoting) 和 Web 消息传递 (messaging) 技术,以LGPL(Lesser GNU Public License)公共许 ...

  9. 配置Apache2 管理 SVN

    软件环境:CentOS-7-x86_64 1.安装 mod_dav_svn   模块 2.在Apache2下增加管理配置,如: cd /etc/httpd/conf.d vim subversion. ...

  10. 一段简单c程序的汇编语言学习(ubuntu+x86)

    c程序代码: #include <stdio.h> int main(void) { int i=0, j=0; for(i=0; i<8; i++) j=j+1; return 0 ...