- 卉图编程奥赛部寒假班结课测试
4
- 2024-3-10 15:13:01 @
#include<bits/stdc++.h> using namespace std; typedef struct { string name; int y; int m; int d; int id; }ss; ss sr[200]; bool pd(ss a,ss b){ if (a.y < b.y){ return true; } else if(a.y == b.y){ if (a.m < b.m){ return true; } else if (a.m == b.m){ if (a.d < b.d){ return true; } else if (a.d == b.d){ if (a.id > b.id){ return true; } else{ return false; } } else{ return false; } } else{ return false; } } else{ return false; } } int main(){ int n; cin >>n; for(int i = 0;i<n;i++){ cin >>sr[i].name>>sr[i].y>>sr[i].m>>sr[i].d; sr[i].id = i; } sort(sr,sr + n,pd); for (int i = 0;i<n;i++){ cout <<sr[i].name<<endl; } }
1 条评论
-
corey0208 LV 8 @ 2024-3-12 20:43:47
你是怎么发讨论的
- 1