健身

题目 健身

2f63cc6e0ac3b9fc6f105f95e5457596-2f63cc6e

思路分析

代码实现

 #include<bits/stdc++.h>
using namespace std;
#define endl '\n'

int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n;cin>>n;
    long long chest=0,biceps=0,back=0;
    for(int i=1;i<=n;i++){
        int temp;cin>>temp;
        if(i%3==1)  chest+=temp;
        if(i%3==2)  biceps+=temp;
        if(i%3==0)  back+=temp;
    }
    long long maxnum=max(max(chest,biceps),back);
    if(maxnum==chest)   cout<<"chest"<<endl;
    if(maxnum==biceps)  cout<<"biceps"<<endl;
    if(maxnum==back)    cout<<"back"<<endl;
    return 0;
}

同类题型

视频讲解


⬅️ 6、特别数的和 🏠 00-刷题理模型 ➡️ 农夫约翰的奶酪块