forked from anubhab91/CodeForces-5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGregsWorkout.py
More file actions
36 lines (23 loc) · 951 Bytes
/
GregsWorkout.py
File metadata and controls
36 lines (23 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
__author__ = 'Devesh Bajpai'
'''
https://codeforces.com/problemset/problem/255/A
Solution: Get the sum of the exercise counts for the 3 types. The quicker pythonic way is to use the following notation
to get sub-list : listVar[startIndex:endIndex:step].
Using this, we need every third exercise count, starting from 0 for chest, from 1 for biceps and 2 for back.
Interestingly this takes care if the list doesn't have enough elements to get that sub-list. Find the sums and return
the max-one.
'''
def solve(exercises):
chest = sum(exercises[0::3])
biceps = sum(exercises[1::3])
back = sum(exercises[2::3])
maxExercise = "chest"
if biceps > chest and biceps > back:
maxExercise = "biceps"
elif back > chest and back > biceps:
maxExercise = "back"
return maxExercise
if __name__ == "__main__":
n = int(raw_input())
exercises = map(int, raw_input().split(" "))
print solve(exercises)