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 liuzilin114514 @ 2024-02-18 20:15:39
@yaodiguoan 你这道题对了吗?
by danlao @ 2024-02-18 20:16:08
@liuzilin114514 对了,把那地方改一下就对了。
by danlao @ 2024-02-18 20:16:39
@liuzilin114514 record
by liuzilin114514 @ 2024-02-18 20:17:08
@yaodiguoan 666
by liuzilin114514 @ 2024-02-18 20:17:27
@yaodiguoan 你几年级
by liuzilin114514 @ 2024-02-18 20:18:54
@yaodiguoan 其实我是个小学生
by danlao @ 2024-02-18 20:19:05
@liuzilin114514 --...
by liuzilin114514 @ 2024-02-18 20:19:59
@yaodiguoan 咋了?
by danlao @ 2024-02-18 20:21:31
@liuzilin114514 一语双关,一方面表示我无语,另一方面写出了我的年级。
by liuzilin114514 @ 2024-02-18 20:22:49
@yaodiguoan 你初一?