Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
新手求助~!~!!!!!SAMPLE OUTPUT是对的,不知道为什么会OLE呢???哪位前辈给指点一下~谢谢!#include<stdio.h> int main() { int m,k,i,j,n,temp_1,num[100]; char a[100][50],*p[100],*ptemp; scanf("%d %d",&n,&m); for(i=0;i<m;i++) scanf("%s",a[i]); for(i=0;i<m;i++) { num[i]=0; for(j=0;j<n-1;j++) for(k=j+1;k<n;k++) { if(a[i][j]-a[i][k]>0) num[i]+=1; } } for(i=0;i<m;i++) p[i]=a[i]; for(i=0;i<m-1;i++) { for(j=0;j<m-i-1;j++) { if(num[j]<=num[j+1]) { temp_1=num[j]; num[j]=num[j+1]; num[j+1]=temp_1; ptemp=p[j]; p[j]=p[j+1]; p[j+1]=ptemp; } } printf("%s\n",p[j]); } printf("%s\n",p[0]); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator