九十分求助

P5740 【深基7.例9】最厉害的学生

BeiShaoDe @ 2024-10-09 19:29:23

九十分求助,请大佬看一下,谢谢了


by LionBlaze @ 2024-10-09 19:42:19

@BeiShaoDe Talk is cheap. Show me your code.


by JH666FH @ 2024-10-15 19:02:12

大佬求助

#include <bits/stdc++.h>
using namespace std;
string name[10001];
int a[10001],b[10001],c[10001],sum[10001],n,k,max1;
int main(){
    cin>>n;
    int i;
    for(i=1;i<=n;i++){
        cin>>name[i]>>a[i]>>b[i]>>c[i];
        sum[i]=a[i]+b[i]+c[i];
        if (sum[i]>max1){
            max1=sum[i];
            k=i;
        }
    }
    cout<<name[k]<<" "<<a[k]<<" "<<b[k]<<" "<<c[k]<<endl;
    return 0;
}

|