| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
莫名其妙的TLE...............................怎么就TLE了...无语
#include <iostream>
using namespace std;
struct student
{
char _student_name_[50];
int _examination_scores;
}stu[10001],temp;
int n,e;
int main()
{
int i,j,k,lm_s=0;
scanf("%d",&n);
getchar();
for(i=1;i<=n;i++)
{
gets(stu[i]._student_name_);
stu[i]._examination_scores=0;
}
scanf("%d",&e);
for(i=1;i<=e;i++)
{
for(j=1;j<=n;j++)
{
scanf("%d",&temp._examination_scores);
getchar();
gets(temp._student_name_);
if(strcmp(temp._student_name_,"Li Ming")==0)
lm_s+=temp._examination_scores;
for(k=1;k<=n;k++)
if(strcmp(temp._student_name_,stu[k]._student_name_)==0)
{
stu[k]._examination_scores+=temp._examination_scores;
break;
}
}
k=1;
for(j=1;j<=n;j++)
if(stu[j]._examination_scores>lm_s)
k++;
printf("%d\n",k);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator