我代码太短不给我交!?

P1093 [NOIP2007 普及组] 奖学金

葵花油oil @ 2019-08-01 07:44:09

#include<bits/stdc++.h>
using namespace std;
struct stu{
    int num,sum,chi;
}a[1001];
int cmp(stu a,stu b){
    return (a.sum>b.sum)||(a.sum==b.sum&&a.chi>b.chi)||(a.sum==b.sum&&a.chi==b.chi&&a.num<b.num);
}
int n,x,y;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i].chi>>x>>y;
        a[i].num=i;
        a[i].sum=a[i].chi+x+y;
    }
    sort(a+1,a+n+1,cmp);
    for(int i=1;i<=5;i++){
        cout<<a[i].num<<' '<<a[i].sum<<endl;
    }
}

怎么肥四啊?


by yu__xuan @ 2019-08-01 07:46:02

+1


by ueettttuj @ 2019-08-01 07:47:10

+1

by getchar123 @ 2019-08-01 07:56:55

。。好像开O2可以交。。


by YU401 @ 2019-08-01 07:57:25

+1


by Eason_AC @ 2019-08-01 08:04:04

+1


by pzc2004 @ 2019-08-01 09:00:02

+1

by zhjzhmh @ 2019-08-14 15:25:58

++++++++++1


by Wei_wei_ @ 2020-07-10 16:34:20

没有啊,我可以啊?


|