Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
157049 张浩然 奖学金 C++ Compile Error 0 MS 0 KB 643 2026-07-13 14:03:44

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; struct student{ string id; int cj[3]; }; bool cmp(student a,student b){ if(a.cj[0]+a.cj[1]+a.cj[2]>b.cj[0]+b.cj[1]+b.cj[2]){ return 1; }else if(a.cj[0]+a.cj[1]+a.cj[2]==b.cj[0]+b.cj[1]+b.cj[2]){ if(a.cj[0]>b.cj[0]){ return 1; }else if(a.cj[0]==b.cj[0]){ if(a.id>b.id){ return 1; } } } return 0; } int main(){ int n; cin>>n; student x[n]; for(int i=0;i<n;i++){ cin>>x[i].id>>x[i].cj[0]>>x[i].cj[1]>>[i].cj[2]; } sort(x+0,x+n,cmp); for(int i=0;i<n;i++){ cout<<x[i].id<<" "<<x[i].cj[0]+x[i].cj[1]+x[i].cj[2]<<endl; } return 0; }


Run Info:

Main.cc: In lambda function:
Main.cc:26:44: error: expected '{' before '.' token
   cin>>x[i].id>>x[i].cj[0]>>x[i].cj[1]>>[i].cj[2];
                                            ^
Main.cc: In function 'int main()':
Main.cc:26:45: error: 'struct main()::' has no member named 'cj'
   cin>>x[i].id>>x[i].cj[0]>>x[i].cj[1]>>[i].cj[2];
                                             ^