64求条
  • 板块P1104 生日
  • 楼主de_mu_lan
  • 当前回复5
  • 已保存回复6
  • 发布时间2025/7/29 14:32
  • 上次更新2025/7/29 19:12:38
查看原帖
64求条
664531
de_mu_lan楼主2025/7/29 14:32
#include<bits/stdc++.h>
using namespace std;
struct student{
	string s;
	int y;
	int m;
	int d;
	int birthday;
}; 
int main(){
	string s; int n,y,m,d;
	cin>>n;
	vector<student> sI;
	student item;
	for(int i=0;i<n;i++){
		cin>>s>>y>>m>>d;
		item.s=s;
		item.y=y;
		item.m=m;
		item.d=d;
		item.birthday=d+100*m+10000*y;//这里蒟蒻尝试把年月日转为一串数字方便排序
		sI.emplace_back(item);
	}
	stable_sort(sI.begin(), sI.end(),[](const student& a, const student& b) {
		return a.birthday< b.birthday;
    });
    for (const auto& p : sI)
        cout<<p.s<<endl;
	return 0;
}

评测记录 deepseek都说我没问题洛谷凭什么说我WA

2025/7/29 14:32
加载中...