好多次了,一直RE,好烦
#include<bits/stdc++.h>
using namespace std;
struct student {
string name;
int y, m, d;
}c[105];
bool cmp(student a, student b) {
if (a.y != b.y)
return a.y < b.y;
if (a.m != b.m)
return a.m < b.m;
return a.d <= b.d;
}
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> c[i].name >> c[i].y >> c[i].m >> c[i].d;
}sort(c + 1, c + n + 1, cmp);
for (int i = n; i > 0; i++) {
cout << c[i].name << endl;
}return 0;
}
有问题吗...