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

Time Limit Exceed 哪位大哥帮小弟指点一下....非常感谢!!

Posted by Santana at 2008-02-10 10:10:16 on Problem 2153
#include<iostream>
using namespace std;
#include<string.h>
void main()
{
	int n,m,t,k,ls,score,rank,s[10001];
	char name[31];
	scanf("%d",&n);
	getchar();
	for(int i=0;i<n;i++)
		gets(name);
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		for(int j=0;j<n;j++)
		{
			scanf("%d",&s[j]);
			getchar();
			gets(name);
			if(strcmp("Li Ming",name)==0)
				ls=s[j];
		}
		for(j=0;j<n-1;j++)
			for(k=j+1;k<n;k++)
			{
				if(s[k]>s[j])
				{
					t=s[j];
					s[j]=s[k];
					s[k]=s[j];
				}
				if(s[k]==s[j])
					s[k]=0;
			}
			for(k=0;k<n;k++)
				if(ls==s[k])
					rank=k+1;
			printf("%d\n",rank);
	}
}






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