大佬求助
  • 板块P1104 生日
  • 楼主2011Andy
  • 当前回复6
  • 已保存回复6
  • 发布时间2023/3/22 20:19
  • 上次更新2023/10/23 20:50:20
查看原帖
大佬求助
660871
2011Andy楼主2023/3/22 20:19
#include <bits/stdc++.h>
using namespace std;
struct sb{
	string a;
	int y , m , d;
};
bool cmp(sb x , sb z){
    return x.y < z.y; 
}
bool cmp1(sb x , sb z){
    return x.m < z.m; 
}
bool cmp2(sb x , sb z){
    return x.d < z.d; 
}
int main(){
	sb s[105];
    int n;
    cin >> n;
    for(int i = 1 ; i <= n ; i++) cin >> s[i].a >> s[i].y >> s[i].m >> s[i].d;
	sort(s + 1 , s + n + 1 , cmp);
	sort(s + 1 , s + n + 1 , cmp1);
	sort(s + 1 , s + n + 1 , cmp2);
	for(int i = 1 ; i <= n ; i++) cout << s[i].a << endl; 
    return 0;
}
2023/3/22 20:19
加载中...