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 328776870 at 2006-09-24 17:34:39
为什么老是不对呢?
	#include<stdio.h>
main()
{
 int a,b,c,i,j;
 int counter[100]={0};
 char str[100][50],temp;
 scanf("%d %d",&a,&b);
 for(i=0;i<a;i++)
	 {for(j=0;j<b;j++)
		 {scanf("%c",&str[i][j]);
		 } 
	 }
 for(i=0;i<a;i++)
	 {for(j=1;j<b;j++)
	     for(c=0;c<j;c++)
		 if(str[i][c]>str[i][j]) counter[i]++;
		
	 }
 for(i=0;i<a-1;i++)
	 for(j=i+1;i<a;j++)
      if(counter[j]<counter[i])
	  {  for(c=0;c<b;c++)
		   {
	        temp=str[i][c];
	        str[i][c]=str[j][c];
		     str[j][c]=temp;
		   }
	  } 
  for(i=0;i<a;i++)
	  for(j=0;j<b;j++)
		  printf("%c",str[i][j]);
} 
	

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