真是玄学的题目

P1093 [NOIP2007 普及组] 奖学金

SetsunaFSeiei @ 2018-11-06 17:04:53

#include<bits/stdc++.h>
using namespace std;
struct student{
    int cscore,mscore,escore,sscore,nom;
}a[310];
int n,i;
int score_comp(const student a,const student b);
int main()
{
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a[i].cscore;
        cin>>a[i].mscore;
        cin>>a[i].escore;
        a[i].sscore=a[i].cscore+a[i].mscore+a[i].escore;
        a[i].nom=i;
    }
    sort(a+1,a+n+1,score_comp);
    for(i=1;i<=5;i++)
    {
        cout<<a[i].nom<<" "<<a[i].sscore<<endl; 
    }
}
int score_comp(const student a,const student b)
{
    if(a.sscore>b.sscore)
      return 1;

    else if(a.cscore>b.cscore)
      return 1;

    if(a.nom<b.nom)
      return 1;

      return 0;
}

为什么0分...


|