猪皮i 2018-12-09 16:55
浏览 400

杭电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;
}

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
    • ¥15 让node服务器有自动加载文件的功能
    • ¥15 jmeter脚本回放有的是对的有的是错的
    • ¥15 r语言蛋白组学相关问题
    • ¥15 Python时间序列如何拟合疏系数模型