| ||||||||||
| 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 | |||||||||
Time Limit Exceed 哪位大哥帮小弟指点一下....非常感谢!!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator