|
- #include<algorithm>
- #include<iostream>
- using namespace std;
- struct student
- {
- int y,m,d,id;
- string name;
- } a[9999];
- bool operator< (student a,student b)
- {
- if(a.y>b.y) return 0;
- else if(a.y<b.y) return 1;
- if(a.m>b.m) return 0;
- else if(a.m<b.m) return 1;
- if(a.d>b.d) return 0;
- else if(a.d<b.d) return 1;
- return a.id>b.id;
- }
- int n;
- int main()
- {
- cin>>n;
- for(int i=1; i<=n; i++)cin>>a[i].name>>a[i].y>>a[i].m>>a[i].d,a[i].id=i;
- sort(a+1,a+n+1);
- for(int i=1; i<=n; i++)cout<<a[i].name<<endl;
- return 0;
- }
复制代码 |
|