为什么wa了

P1093 [NOIP2007 普及组] 奖学金

帅皮的瓜粉 @ 2020-03-18 20:31:46

#include<bits/stdc++.h>
using namespace std;
struct cjb
{
    int yw,sx,zf,yy,xh;
};
cjb x[100000];bool xxx(cjb a,cjb b)
{
    if(a.zf!=b.zf)return a.zf>b.zf;
        else if(a.yw!=b.yw)return a.yw>b.yw;
            else if(a.sx!=b.sx)return a.sx>b.sx;
                else if(a.zf!=b.zf)return a.zf>b.zf;
                    else return a.xh<b.xh;
}
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x[i].yw>>x[i].sx>>x[i].yy;
        x[i].zf=x[i].yw+x[i].sx+x[i].yy;
        x[i].xh=i+1;
    }
    sort(x,x+n,xxx);
    for(int i=0;i<5;i++)
    {
        cout<<x[i].xh<<" "<<x[i].zf<<endl;
    }
    return 0;
}

by awa_qwq_awa @ 2020-03-18 20:35:13

@帅皮的瓜粉 哇!码风清奇!


by 帅皮的瓜粉 @ 2020-03-18 20:35:32

@awa_qwq_awa ???


by tangrunxi @ 2020-03-18 20:36:32

这马蜂


by 做梦想Peach @ 2020-03-18 20:42:47

@帅皮的瓜粉 您是样例没过还是提交上去WA


by 做梦想Peach @ 2020-03-18 20:44:07

@帅皮的瓜粉 您题目没看清楚,

先按总分从高到低排序,如果两个同学总分相同,再按语文成绩从高到低排序,如果两个同学总分和语文成绩都相同,那么规定学号小的同学 排在前面,

by awa_qwq_awa @ 2020-03-18 20:44:36

@2019OuYouKang 提交后WA#8


by 做梦想Peach @ 2020-03-18 20:45:16

@awa_qwq_awa 我改了一下,A了


by 做梦想Peach @ 2020-03-18 20:45:32

#include<bits/stdc++.h>
using namespace std;
struct cjb
{
    int yw,sx,zf,yy,xh;
};
cjb x[100000];bool xxx(cjb a,cjb b)
{if(a.zf!=b.zf)return a.zf>b.zf;
        if(a.yw!=b.yw)return a.yw>b.yw;
}
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x[i].yw>>x[i].sx>>x[i].yy;
        x[i].zf=x[i].yw+x[i].sx+x[i].yy;
        x[i].xh=i+1;
    }
    sort(x,x+n,xxx);
    for(int i=0;i<5;i++)
    {
        cout<<x[i].xh<<" "<<x[i].zf<<endl;
    }
    return 0;
}

by 做梦想Peach @ 2020-03-18 20:45:36

@帅皮的瓜粉


by 帅皮的瓜粉 @ 2020-03-18 20:54:37

@2019OuYouKang 蟹蟹


|