70分,求助!!!

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

diaojt @ 2024-04-20 21:23:50

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
int maxx=0,max1,max2,max3;
string dw;
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        struct stu
        {
            string name;
            int x;
            int y;
            int z;
        };
        struct stu a;
        cin>>a.name;
        cin>>a.x;
        cin>>a.y;
        cin>>a.z;
        if(a.x+a.y+a.z>maxx)
        {
            maxx=a.x+a.y+a.x;
            max1=a.x;
            max2=a.y;
            max3=a.z;
            dw=a.name;
        }
    }
    cout<<dw<<" "<<max1<<" "<<max2<<" "<<max3;
    return 0;
}

by diaojt @ 2024-04-20 21:24:45

@diaojt 70分,求助!!!


by Ivan422 @ 2024-04-20 21:26:46

你似乎没有处理总分相同的情况


|