猪皮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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥35 平滑拟合曲线该如何生成
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站