求助

P1104 生日

wei345 @ 2024-02-18 19:32:02

4,5过不了```cpp

include<iostream>

include<algorithm>

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:08:04

@yaodiguoan 我没发现!!!


by liuzilin114514 @ 2024-02-18 20:09:22

@yaodiguoan 那我为什么还能AC


by danlao @ 2024-02-18 20:09:32

@liuzilin114514 我当时也是这个问题,惨


by liuzilin114514 @ 2024-02-18 20:11:10

@yaodiguoan 你看看我代码


by liuzilin114514 @ 2024-02-18 20:11:34

@yaodiguoan 我为啥能AC


by danlao @ 2024-02-18 20:12:18

@liuzilin114514 布吉岛


by liuzilin114514 @ 2024-02-18 20:13:21

@yaodiguoan 咱俩能互关吗


by danlao @ 2024-02-18 20:13:57

@liuzilin114514 ?????????扯远了


by liuzilin114514 @ 2024-02-18 20:15:10

@yaodiguoan 额


by danlao @ 2024-02-18 20:15:27

@liuzilin114514 可能数据太弱了。


上一页 | 下一页