为啥全RE了
  • 板块P1104 生日
  • 楼主hyh0174
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/12/1 21:48
  • 上次更新2023/12/2 09:09:51
查看原帖
为啥全RE了
439949
hyh0174楼主2023/12/1 21:48
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
struct stu
{
    string s;
    int y,m,d,o;
}sb[110];
bool cmp(stu a,stu b)
{
    if(a.y!=b.y)
        return a.y<b.y?true:false;
    else if(a.m!=b.m)
        return a.m<b.m?true:false;
    else if(a.d!=b.d)
        return a.d<b.d?true:false;
    else
        return a.o>b.o?true:false;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%s %d %d %d",&sb[i].s,&sb[i].y,&sb[i].m,&sb[i].d);
        sb[i].o=i+1;
    }
    stable_sort(sb,sb+n,cmp);
    for(int i=0;i<n;i++)
        printf("%s\n",sb[i].s);
    return 0;
}
2023/12/1 21:48
加载中...