| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 129436 | 常钰杰 | 奖学金 | C++ | Compile Error | 0 MS | 0 KB | 1339 | 2025-08-25 15:41:52 |
#include<bits/stdc++.h> using namespace std; struct stu { int no; int chinese; int math; int english; int total; }; bool cmp(stu x , stu y) { if(x.total < y.total) { return true; } else if(x.total == y.total) { if(x.chinese < y.chinese) { return true; } else if(x.chinese == y.chinese) { if(x.no > y.no) { return true; } else { return false; } } else { return false; } } else { return false; } } int main() { int n; cin >> n; stu s[n]; for(int i = 0; i < n; i++) { s[i].no = i + 1; cin >> s[i].chinese; cin >> s[i].math; cin >> s[i].english; s[i].total = s[i].chinese + s[i].math + s[i].english; } for(int i = 0; i < n - 1; i++) { for(int j = 0; j < n - 1 - i; j++) { if(cmp(a[j] , a[j + 1])) { swap(a[j] , a[j + 1]); } } } for(int i = 0; i < 5; i++) { cout << a[i].no << " " << a[i].total << endl; } return 0; }
Main.cc: In function 'int main()':
Main.cc:65:20: error: 'a' was not declared in this scope
if(cmp(a[j] , a[j + 1]))
^
Main.cc:73:17: error: 'a' was not declared in this scope
cout << a[i].no << " " << a[i].total << endl;
^