本地通过了,交上去就wa了,帮忙看看哪错了,谢谢
//杭电2093考试排名系统#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef struct node
{
char name[15];
int count;
int time;
}ss;
int cmp( const void *a,const void *b )
{
ss *c = ( ss *)a;
ss *d = ( ss *)b;
if( c -> count != d -> count )
return d -> count - c -> count;
if( c -> time != d -> time )
return c -> time - d -> time;
return strcmp( c -> name,d -> name );
}
int main()
{
int m,n,i,j,k,a,b;
ss stu[100];
char c;
scanf( "%d%d",&m,&n );
i = 0;
while( scanf( "%s",stu[i].name ) != EOF )
{
stu[i].count = 0;
stu[i].time = 0;
for( j = 0; j < m; j++ )
{
scanf( "%d",&a );
if( a > 0 )
{
stu[i].count++;
stu[i].time += a;
c = getchar();
if( c == '(' )
{
scanf( "%d",&b );
c = getchar();
stu[i].time += b * n;
}
}
}
i++;
}
qsort( stu,i,sizeof( stu[0]),cmp );
for(j = 0; j < i; j++ )
printf( "%-10s %2d %4d\n",stu[j].name,stu[j].count,stu[j].time );
return 0;
}