0
已解决
曲天歌
高级光能
高级光能
https://judge.codingtang.com/problem/1332/
GE WEI DA LAO MEN ! 各位大佬们!回答一下,紧急亿分!!
曲天歌在2020-01-12 17:26:19追加了内容
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
struct node{
string name;
int year,month,day,flag;
}a[105];
bool cmp(node a,node b)
{
if (a.year==b.year)
{
if (a.month==b.month)
{
if (a.day==b.day)
{
return a.flag<b.flag;
}
else
return a.day<b.day;
}
else
return a.month<b.month;
}
else
return a.year<b.year;
}
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i].name>>a[i].year>>a[i].month>>a[i].day;
a[i].flag=i;
}
sort(a+1,a+n+1,cmp);
for(int i=1;i<=n;i++)
cout<<a[i].name<<endl;
return 0;
}
这是我的0分代码,大佬速速解题
曲天歌在2020-01-12 18:58:08追加了内容
已会!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
曲天歌在2020-01-12 18:58:38追加了内容
将采纳第一个回答