为什么显示提交失败

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

_hello_w_ @ 2021-11-25 13:16:27

`

# include <bits/stdc++.h>
using namespace std;

struct student
{
    string name;
    int y,s,w;
}s[1005];
int n,maxx,t;
int main()
{
    cin>>n;
    for (int i = 0; i < n; i++)
    {
        cin>>s[i].name>>s[i].y>>s[i].s>>s[i].w;
        if (maxx < s[i].y + s[i].s + s[i].w) 
        {
            maxx = s[i].y + s[i].s + s[i].w;
            t = i;
        }
    }
    cout<<s[t].name<<" "<<s[t].y<<" "<<s[t].s<<" "<<s[t].w;
    return 0;
}

by _hello_w_ @ 2021-11-25 13:22:13

提交失败的提示如下: invalid constant value 0 for luogu\type\recordlanguagetype


by skyskyCCC @ 2021-11-25 13:24:58

对,我也是


by Phartial @ 2021-11-25 13:33:04

@壮壮130531 再交一次,洛谷评测机波动问题


by aaazyx @ 2021-11-25 13:37:49

你们可以了吗,我的还是invalid constant value 0 for luogu\type\recordlanguagetype


by _hello_w_ @ 2021-11-25 13:39:21

我使用了结构体方法、和结构体+函数的方法,二种方法都在Dve c++ 5.11 上通过好几组数据验证,不知道为甚这里显示非法字符?


by _hello_w_ @ 2021-11-25 13:42:00

刚刚再次提交,还是非法字符,```

include <bits/stdc++.h>

using namespace std;

struct tx { string name; int y,s,w,sum,sx; }str[1005]; int N; bool comp(tx x,tx y) { if (x.sum == y.sum) return x.sx < y.sx; else return x.sum > y.sum; } int main() { cin>>N; for (int i = 0; i < N; i++) { cin>>str[i].name>>str[i].y>>str[i].s>>str[i].w; str[i].sum = str[i].y + str[i].s + str[i].w; str[i].sx = i+1; } sort(str,str+N,comp); for (int i = 0; i < N; i++) cout<<str[i].name<<" "<<str[i].y<<" "<<str[i].s<<" "<<str[i].w<<" "<<str[i].sum<<" "<<str[i].sx<<endl; cout<<endl; cout<<str[0].name<<" "<<str[0].y<<" "<<str[0].s<<" "<<str[0].w<<" "<<str[0].sum<<" "<<str[0].sx; return 0; }


by _hello_w_ @ 2021-11-25 13:48:12

上课去了,晚上回来看看大神给我传授点什么功夫


by _hello_w_ @ 2021-11-25 18:21:59

@mrsrz @chen_zhe @yyy2015c01 @Anguei

提交已经在Dve c++ 验证的程序,为啥这里会显示 非法字符?


by _hello_w_ @ 2021-11-25 19:57:22

@CYJian 管理员 能指点下 这个问题为什么吗?


by _hello_w_ @ 2021-11-25 20:41:29

@tzc_2012_awa 求教


| 下一页