#6过不了
  • 板块P1104 生日
  • 楼主lyndon
  • 当前回复5
  • 已保存回复5
  • 发布时间2020/5/18 14:54
  • 上次更新2023/11/7 02:13:10
查看原帖
#6过不了
335843
lyndon楼主2020/5/18 14:54
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;

struct date
	{
		string name;
		int sum;
	}a[100];
int cmp(date x,date y)
	{
    	if(x.sum!=y.sum)return x.sum<y.sum;
    	if(x.sum == y.sum)return x.sum>y.sum;
    	return 0;
	}
int main()
	{
		int n;
		cin>>n;
		for(int i = 0;i<n;i++)
			{
				int year,month,day;
				cin>>a[i].name>>year>>month>>day;
				a[i].sum = year*365+month*30+day;
			}
		sort(a,a+n,cmp);
		for(int i = 0;i<n;i++)	
			{
				cout<<a[i].name<<endl;
			}
		return 0;
	}
2020/5/18 14:54
加载中...