P1104 生日
作者:互联网
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
struct Student {
string Name;
int year, month, day, num;
} a[N];
bool cmp(const Student &a, const Student &b) {
if (a.year == b.year)
if (a.month == b.month)
if (a.day == b.day)
return a.num > b.num;
else
return a.day < b.day;
else return a.month < b.month;
else return a.year < b.year;
}
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i].Name >> a[i].year >> a[i].month >> a[i].day;
a[i].num = i;
}
sort(a + 1, a + 1 + n, cmp);
for (int i = 1; i <= n; i++) cout << a[i].Name << endl;
return 0;
}
标签:P1104,return,int,month,num,year,生日,day 来源: https://www.cnblogs.com/littlehb/p/15593214.html