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. Android消息机制不完全解析(上)

        Handler和Message是Android开发者常用的两个API,我一直对于它的内部实现比较好奇,所以用空闲的时间,阅读了一下他们的源码.    相关的Java Class: androi ...

  2. Unity 使用实体类

    故事的由来: 正在开发打飞机的游戏,遇到这样的数据结构,游戏有很多关卡-> 每个关卡有几波怪物->每一波里面有怪物和数量 [] 关卡 { []波{ {怪物,数量},{怪物,数量},{怪物, ...

  3. JavaWeb——文件上传和下载

    在Web应用系统开发中,文件上传和下载功能是非常常用的功能,今天来讲一下JavaWeb中的文件上传和下载功能的实现. 对于文件上传,浏览器在上传的过程中是将文件以流的形式提交到服务器端的,如果直接使用 ...

  4. 认识SVN

    TortoiseSVN 是 Subversion 版本控制系统的一个免费开源客户端,可以超越时间的管理文件和目录.文件保存在中央版本库,除了能记住文件和目录的每次修改以外,版本库非常像普通的文件 服务 ...

  5. Yougth的最大化(好题,二分查找 0 1分数规划)

    Yougth的最大化 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 Yougth现在有n个物品的重量和价值分别是Wi和Vi,你能帮他从中选出k个物品使得单位重量的价 ...

  6. 【gcd+数学证明】【HDU1722】 CAKE

    Cake Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submi ...

  7. 2014年1月24日 Oracle 连接查询与子查询

    1.乘积连接:   源表.源数据交叉链接,结果集数量为源数据之间的乘积 2.相等链接:   通过where关联几个数据源中的某一字段进行链接 3.自链接   自己链接自己 SSF A a1, A a2 ...

  8. 【转】GATT Profile 简介

    网上关于讲解 BLE 的内容比较少,看到这篇文章写的非常详细 Introduction to Bluetooth Low Energy,作为 BLE 的入门时介绍是非常合适的.本文主要翻译了一下这篇文 ...

  9. Python调用C/C++动态链接库

    Python调用C/C++动态链接库 2013年07月26日 ⁄ 综合 ⁄ 共 3219字 ⁄ 字号 小 中 大 ⁄ 评论关闭   吐槽(可略过):不知不觉,4月份毕业,5月份进入团队,已有7个月.大 ...

  10. golang make the first character in a string lowercase/uppercase

    import ( "unicode" ) func UcFirst(str string) string { for i, v := range str { return stri ...