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

太多循环

Posted by youyou at 2007-07-19 07:04:15 on Problem 1007
In Reply To:帮我看看为什么RUNTIME ERROR!! Posted by:13lazyrainy at 2007-05-27 10:15:04
  for (k=0;k<m;k++)
>   { 
           sum[k]=0;
> 	  scanf("%s",&str[k]);
> 	  for (i=0;i<n;i++)
> 		  for (j=i;j<n;j++)
> 		      if (str[k][i]>str[k][j])  sum[k]++;
>   }
> 
>   for (i=0;i<m;i++)
	  for (j=i+1;j<m;j++)        如果i=m-1????????
		  



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;
		  }
	  printf("%s\n",str[i]);
           }
      printf("%s\n",str[i+1]);

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