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

这题怎么会Output Limit Exceed,麻烦帮我看下,谢谢!!

Posted by tangxr at 2006-11-24 12:33:50
#include<stdio.h>
#include<string.h>
#define MAXCLASS 10000
#define MAXSBJ 50
 struct {
  char name[30];
 }studentmane[MAXCLASS];
typedef struct {
  int score;
  char name[30];
 }student;
 typedef struct
  {
    int elem[MAXCLASS];
  } SeqList;

int main()
{
  int n,m,i,j,k,x;
  int rank[MAXSBJ] ;
  int a=0;
  student code,ming;
  SeqList sbj;
  while(scanf("%d",&n)!=EOF)
  {
    for(i=1;i<=n;i++)
      gets(studentmane[i].name);
      getchar();
    scanf("%d",&m);
    for(i=1;i<=m;i++)
      {
        for(j=1;j<=n;j++)
           sbj.elem[j]=0;
        for(j=1;j<=n;j++)
         {
           scanf("%d ",&code.score);
           gets(code.name);
             if(!strcmp("Li Ming",code.name))
               ming.score=code.score;
             for(x=1;x<=n;x++)
              if(!strcmp(studentmane[x].name,code.name))
                a=1;
             if(a==1)
             {
             if(j==1)
                sbj.elem[j]=code.score;
             for(k=1;k<j;k++)
               {
                 if(code.score>=sbj.elem[k])
                  {  for(x=j;x>k;x--)
                     {sbj.elem[x]=sbj.elem[x-1];
                     sbj.elem[k]=code.score;
                     }
                   }
                   else
                    sbj.elem[j]=code.score;
               }
              }
          }
          for(k=1;k<=n;k++)
            if(ming.score==sbj.elem[k])
            {rank[i]=k;break;}

        }
        for(i=1;i<=m;i++)
         printf("%d\n",rank[i]);
    }
}
    

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