wei345 @ 2024-02-18 19:32:02
4,5过不了```cpp
using namespace std;
struct St{
string s;
int y,m,d,id,k;
}a[110];
int cmp(St a,St b){
if(a.k<b.k) return 1;
else if(a.k==b.k) return a.id<b.id;
return 0;
}
int n;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i].s>>a[i].y>>a[i].m>>a[i].d;
a[i].id=i;
a[i].k=a[i].d+a[i].m100+a[i].y10000;
}
sort(a+1,a+n+1,cmp);
for(int i=1;i<=n;i++){
cout<<a[i].s<<endl;
}
return 0;
}
by danlao @ 2024-02-18 20:31:57
@wei345
by wei345 @ 2024-02-18 20:35:08
@yaodiguoan 我五年级,看不太懂那符号
by danlao @ 2024-02-18 20:37:14
@wei345
by danlao @ 2024-02-18 20:38:18
@wei345