杭电oj2093测试样例对了,但是提交的时候显示wrong answer

#include
#include
#include
#include
#include
using namespace std;
struct student
{
char name[20];
int sumsolve;
int sumscore;
}people[10000],temp;
int main ()
{
int n,m;
cin>>n>>m;
getchar();
int i=0,j;
while(cin>>people[i].name)
{
char str1[10],str2[10],str[10];
people[i].sumsolve=0;
people[i].sumscore=0;
for (j=0;j {
cin>>str;
if (str[0]>='1'&&str[0]<='9')
{
int k,t=0;
people[i].sumsolve++;
for (k=0;k if(str[k]=='(')
break;
if(k {
for (k=0;str[k]!='(';k++)
str1[t++]=str[k];
str1[t]='\0';
t=0;
for (k++;str[k]!=')';k++)
str2[t++]=str[k];
str2[t]='\0';
people[i].sumscore+=atoi(str1)+atoi(str2)*m;
}
else
{
for (k=0;k str1[t++]=str[k];
str1[t]='\0';
people[i].sumscore+=atoi(str1);
}
}
}
getchar();
i++;
}
for (i=0;i for (j=i+1;j {
if(people[i].sumsolve {
temp=people[i];
people[i]=people[j];
people[j]=temp;
}
else if(people[i].sumsolve==people[j].sumsolve)
{
if(people[i].sumscore>people[j].sumscore)
{
temp=people[i];
people[i]=people[j];
people[j]=temp;
}
else if(people[i].sumscore==people[j].sumscore)
{
if(strcmp(people[i].name,people[j].name))
{
temp=people[i];
people[i]=people[j];
people[j]=temp;
}
}
}
}
for (i=0;i<6;i++)
cout<<setiosflags(ios::left)<<setw(10)<<people[i].name<<" "<<setw(2)<<people[i].sumsolve<<" "<<setw(4)<<people[i].sumscore<<endl;
}

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐