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

    http://www.zhukun.net/archives/5794

  2. sqlite数据库方言配置

    1. application.properties配置sqlite数据库 spring.datasource.url = jdbc:sqlite:C:/test/sqlite/DB/sqlite.db ...

  3. Java 的zip压缩和解压缩

    Java 的zip压缩和解压缩 好久没有来这写东西了,今天中秋节,有个东西想拿出来分享,一来是工作中遇到的问题,一来是和csdn问候一下,下面就分享一个Java中的zip压缩技术,代码实现比较简单,代 ...

  4. poj1184 聪明的打字员(BFS剪枝)

    http://poj.org/problem?id=1184 用字符串s存下数字,并把光标位置做一个字符加到s末尾,用map做标记状态是否出现过,然后bfs即可. 不剪枝是过不了的,考虑的两种交换操作 ...

  5. 从一段代码看fork()函数及其引发的竞争

    首先来看一段从<UNIX环境高级编程>中摘录的一段很有意思的代码.借此我们再来谈谈fork()函数的一些问题. #include "apue.h" static voi ...

  6. 创建mvc

    有几个界面就建几个文件夹 每个文件夹中都有三个文件夹,(models,Controllers,views) 创建一个common 和一个Base文件夹(先建文件夹,可以直接拉进去) common的目的 ...

  7. (转)C/C++中static关键字

    下面的转自http://www.cnblogs.com/yc_sunniwell/archive/2010/07/14/1777441.html 静态变量作用范围在一个文件内,程序开始时分配空间,结束 ...

  8. Hadoop配置文件-hdfs-site.xml

     name  value Description  dfs.default.chunk.view.size 32768 namenode的http访问页面中针对每个文件的内容显示大小,通常无需设置. ...

  9. PHP封装Excel表方法使用流程

    今天总结了一下Excel表的封装和导出使用,原理 经常使用与一些日常报表, 数据报表, 实现方法比较简单, 一次封装, 简单的方法调用,简单~ 废话不多说,直接入正题, 先说下重要的参数要记住的东西 ...

  10. MySQL 指定数据库字符集的 3 种方法。

    方法 1.创建数据库时指定字符集. create database Studio character set utf8; 方法 2.创建表的时候针对列指定字符集. create table T( x ...