大佬们帮看看,这题为什么全RE了

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

逍遥九霄 @ 2021-08-19 19:08:20


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<stdio.h>
using namespace std;
struct student
{
    char name[10];
    int ch,mt,en,all;
};
student a[10001];
int n,max=0,s=0;
int main()
{
    int n,max,s=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i].name>>a[i].ch>>a[i].mt>>a[i].en;
        a[i].all=a[i].ch+a[i].mt+a[i].en;
    }
    for(int i=0;i<n;i++)
    {
        if(a[i].all>max)
        {
            max=a[i].all;
            s=i;
        }
    }
    cout<<a[s].name<<" "<<a[s].ch<<" "<<a[s].mt<<" "<<a[s].en;
    return 0;
} 

by Textbook_blasphemy @ 2021-08-19 19:13:20

@Epdong338066 你没输入n


by Hanriver @ 2021-08-19 19:15:31

请学会使用调试键


by 添哥 @ 2021-08-19 19:15:46

您怕不是样例都没测。。


by 逍遥九霄 @ 2021-08-19 19:15:56

@陶(戴)佳伟 额呵呵,对不起我是个盲人


by 逍遥九霄 @ 2021-08-19 19:16:30

有点小尴尬


by 添哥 @ 2021-08-19 19:17:07

好巧,我也经常忘记输入n


|