这是哪里出了问题
  • 板块P1104 生日
  • 楼主huge_wave
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/6/10 15:57
  • 上次更新2024/6/10 18:45:55
查看原帖
这是哪里出了问题
1269423
huge_wave楼主2024/6/10 15:57
#include<bits/stdc++.h>
using namespace std;
const int N=100;
typedef long long ll;
int n;
struct sd{
	string s;
	int a,b,c;
};
bool cmp(sd&k,sd&l){
	if(k.a==l.a){
		if(k.b==l.b){
			return k.c<l.c;
		}
		else{
			k.b<l.b;
		}
	}
	else{
		return k.a<l.a;
	}
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n;
	sd w[n+1];
	
	for(int i=n;i>=1;i--){
		cin>>w[i].s>>w[i].a>>w[i].b>>w[i].c;
	}
	stable_sort(w+1,w+1+n,cmp);
	for(int i=1;i<=n;i++){
		cout<<w[i].s<<'\n';
	}
	return 0;
}

2024/6/10 15:57
加载中...