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 hebeboy at 2008-07-22 20:14:39 on Problem 1007
#include"stdio.h"
#include"string.h"
void main()
{int x,y,d[30],i,k,j,s,t,m,n,l,o,b[30][50],q,w;
 char a[30][50],temp[50];
 for(i=0;i<=29;i++)
 d[i]=0;
 scanf("%d %d",&y,&x);
 for(m=0;m<=x-1;m++) 
  scanf("%s",a[m]);  
  for(k=0;k<=x-1;k++)
   {for(j=0;j<=y-1;j++)
    for(s=j+1;s<=y-1;s++)
     if(a[k][j]>a[k][s])d[k]++;     
     }
 for(l=x-1;l>=1;l--)
  for(o=x-1;o>=x-l;o--)
	{if(d[o-1]<d[o])
	  {strcpy(temp,a[o-1]);
	   strcpy(a[o-1],a[o]);
       strcpy(a[o],temp);
	  }
	}
	for(t=x-1;t>=0;t--)
	printf("%s\n",a[t]);
}

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