HUD 1084是哪错了,能帮我试试数据么?样例都过了,提交不对
http://acm.hdu.edu.cn/showproblem.php?pid=1084
OJ
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
struct Stu
{
int solved;
int h,m,s;
int score;
int seq;
};
bool cmp(Stu a,Stu b)
{
if(a.h<b.h)return 1;
else if(a.h>b.h)return 0;
else if(a.h==b.h)
{
if(a.m<b.m)return 1;
else if(a.m>b.m)return 0;
else if(a.m==b.m)
{
if(a.s<b.s)return 1;
else return 0;
}
}
}
Stu stu[200];
int main()
{
int N;
while(cin>>N,N>0)
{
vector<Stu> q5,q4,q3,q2,q1,q0;
for(int i=0; i<N; i++)
{
scanf("%d%d%*c%d%*c%d",&stu[i].solved,&stu[i].h,&stu[i].m,&stu[i].s);
stu[i].seq=i;
if(stu[i].solved==5)q5.push_back(stu[i]);
else if(stu[i].solved==4)q4.push_back(stu[i]);
else if(stu[i].solved==3)q3.push_back(stu[i]);
else if(stu[i].solved==2)q2.push_back(stu[i]);
else if(stu[i].solved==1)q1.push_back(stu[i]);
else if(stu[i].solved==0)q0.push_back(stu[i]);
}
if(!q5.empty())
{
//sort(q5.begin(),q5.end(),cmp);
for(int i=0; i<q5.size(); i++)
q5[i].score=100;
}
if(!q4.empty())
{
sort(q4.begin(),q4.end(),cmp);
for(int i=0; i<q4.size()/2; i++)
q4[i].score=95;
for(int i=q4.size()/2; i<q4.size(); i++)
q4[i].score=90;
}
if(!q3.empty())
{
sort(q3.begin(),q3.end(),cmp);
for(int i=0; i<q3.size()/2; i++)
q3[i].score=85;
for(int i=q3.size()/2; i<q3.size(); i++)
q3[i].score=80;
}
if(!q2.empty())
{
sort(q2.begin(),q2.end(),cmp);
for(int i=0; i<q2.size()/2; i++)
q2[i].score=75;
for(int i=q4.size()/2; i<q2.size(); i++)
q2[i].score=70;
}
if(!q1.empty())
{
sort(q1.begin(),q1.end(),cmp);
for(int i=0; i<q1.size()/2; i++)
q4[i].score=65;
for(int i=q1.size()/2; i<q1.size(); i++)
q1[i].score=60;
}
if(!q0.empty())
{
//sort(q0.begin(),q0.end(),cmp);
for(int i=0; i<q0.size(); i++)
q0[i].score=50;
}
for(int i=0; i<N; i++)
{
for(int j=0; j<q5.size(); j++)
if(q5[j].seq==i)cout<<q5[j].score<<endl;
for(int j=0; j<q4.size(); j++)
if(q4[j].seq==i)cout<<q4[j].score<<endl;
for(int j=0; j<q3.size(); j++)
if(q3[j].seq==i)cout<<q3[j].score<<endl;
for(int j=0; j<q2.size(); j++)
if(q2[j].seq==i)cout<<q2[j].score<<endl;
for(int j=0; j<q1.size(); j++)
if(q1[j].seq==i)cout<<q1[j].score<<endl;
for(int j=0; j<q0.size(); j++)
if(q0[j].seq==i)cout<<q0[j].score<<endl;
}
cout<<endl;
}
return 0;
}