MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Codeforces_problems/Greg's Workout/solution.cpp:7–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5typedef long long int ll;
6
7int main()
8{
9 // a for chest, b for biceps and c for back
10
11 int n, t, a=0, b=0, c=0;
12 cin >> n;
13
14 // Here we are not storing the n integers in an array.
15 // Instead, we know 1, 1+3, 1+3+3 entry corresponds to chest
16 // Similarly 2, 2+3, 2+3+3 entry corresponds to biceps
17 // 3, 3+3, 3+3+3 entry corresponds to chest.
18 // To be more clear the n integers are like chest, biceps, back, chest, biceps, back and so on upto n.
19 for (int i = 1; i <= n; i++) // Loop Runs for 'n' Times.
20 {
21 cin >> t; // This is nth integer
22 if (i % 3 == 1)
23 a += t;
24 else if (i % 3 == 2)
25 b += t;
26 else
27 c += t;
28 }
29
30 // Now applying the logic of maximum among 3 numbers and displaying the desired result.
31 if (a>b && a > c)
32 cout << "chest" << endl;
33 else if (b>a && b>c)
34 cout << "biceps" << endl;
35 else
36 cout << "back" << endl;
37
38 return 0;
39}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected