Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

莫名其妙的TLE...............................

Posted by majia5 at 2008-07-26 11:08:48 on Problem 2153 and last updated at 2008-07-26 11:36:05
怎么就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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator