一直re,求大神解释 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1236
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
struct student
{
char kaohao[25];
int score;
};
bool cmp(student x,student y)
{
if(x.score!=y.score)return x.score>y.score;
else return strcmp(x.kaohao,y.kaohao)<=0;
}
int main()
{
int renshu,tishu,fenxian,ji;
student a[1005];
while(scanf("%d",&renshu) && renshu)
{
ji = 0;
memset(a,0,sizeof(a));
int count,tifen[25];
scanf("%d%d",&tishu,&fenxian);
for(int i = 1;i<=tishu;i++)
{
scanf("%d",&tifen[i]);
}
for(int i = 1;i<=renshu;i++)
{
getchar();
scanf("%s%d",a[i].kaohao,&count);
for(int j = 1;j<=count;j++)
{
int temp;
scanf("%d",&temp);
a[i].score += tifen[temp];
}
if(a[i].score>=fenxian)
ji++;
}
sort(a+1,a+renshu+1,cmp);
printf("%d\n",ji);
for(int i = 1;;i++)
{
if(a[i].score<fenxian)
{break;}
else printf("%s %d\n",a[i].kaohao,a[i].score);
}
}
}