84第五个点没过求助
  • 板块P1104 生日
  • 楼主Acheron_
  • 当前回复3
  • 已保存回复3
  • 发布时间2025/7/1 18:21
  • 上次更新2025/7/2 12:40:42
查看原帖
84第五个点没过求助
1665328
Acheron_楼主2025/7/1 18:21
#include<bits/stdc++.h>
using namespace std;
struct st{
	string s;
	int y,m,d;
}a[1000000];
bool cmp(st c,st b){
	if(c.y<b.y)return 1;
	else if(c.y>b.y)return 0;
	else {
		if(c.m<b.m)return 1;
		else if(c.m>b.m)return 0;
		else {
			if(c.d<b.d)return 1;
			else if(c.d>b.d )return 0;
			else if(c.d==b.d)return 1;
		}
	}
}
int main(){
	int n;cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].s>>a[i].y>>a[i].m>>a[i].d;
	}
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++){
		cout<<a[i].s<<endl;
	}
	return 0;
	
} 
2025/7/1 18:21
加载中...