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

Re: HELP!!在下新手,这个代码在我机子上可以运行,为什么提交就有问题呢,

Posted by ieslyuan1987 at 2008-03-16 23:36:53 on Problem 1007
In Reply To: HELP!!在下新手,这个代码在我机子上可以运行,为什么提交就有问题呢, Posted by:snowfall at 2008-03-16 15:59:19
> #include<stdio.h>
> #include<string.h>
> main()
> {
>       char str[51][101];
>       char temp[100]; 
>       int sum[101];
>       int i,j,k,m,n,t;
>       
>       scanf("%d%d",&n,&m);
>       for(i=0;i<m;i++)
>        scanf("%s",&str[i]);
>       
>       for(i=0;i<m;i++)
>         sum[i]=0;
>      for(i=0;i<m;i++)    
>       {for(j=0;j<n-1;j++)
>         {for(k=j+1;k<n;k++)
>             if(str[i][j]>str[i][k])
>                 sum[i]++;
>         }
>       }
>  
>      for(i=0;i<m-1;i++)
>     {   for(j=i+1;j<m;j++)
>     
>          { if(sum[i]>sum[j])
>             {    strcpy(temp,str[i]);
>                  strcpy(str[i],str[j]);
> 			     strcpy(str[j],temp);
> 			      t=sum[i];
> 			      sum[i]=sum[j];
> 			      sum[j]=t;
>              } 
>          }     
>      }
>      
>      for(i=0;i<m;i++)
>            printf("%s\n",str[i]);
>       
>     getchar();  
>     getchar();
> }

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