WA第一个点 \//\\/

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

sLMxf @ 2022-10-24 19:10:04

代码是这样:

#include<bits/stdc++.h>
using namespace std;
struct student{
    string name;
    int chinese;
    int math;
    int english;
    int score;
}a[1100];
student maxs;
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i].name>>a[i].chinese>>a[i].math>>a[i].english;
        a[i].score=a[i].chinese+a[i].math+a[i].english;
        if(a[i].score>maxs.score) maxs=a[i];
    }
    cout<<maxs.name<<" "<<maxs.chinese<<" "<<maxs.math<<" "<<maxs.english;
    return 0;
}

WA WA? (Why Answer WA?)


by Fsdyofficial @ 2022-10-24 19:16:07

3
a 0 0 0
b 0 0 0
c 0 0 0

|