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 |
为什么会wa#include<stdio.h> int main() { int a[51],b[51],n,m,i,j,k,min,temp; char s[51][101]; scanf("%d%d",&m,&n); getchar(); for(i=0;i<n;i++) a[i]=0; for(i=0;i<n;i++) { gets(s[i]); for(j=0;j<m-1;j++) for(k=j+1;k<m;k++) if(s[i][j]>s[i][k]) a[i]++; } for(i=0;i<n;i++) b[i]=a[i]; for(i=0;i<n;i++) { min=i; for(j=i+1;j<n;j++) if(a[j]<a[min]) min=j; temp=a[min]; a[min]=a[i]; a[i]=temp; } for(i=0;i<n;i++) for(j=0;j<n;j++) if(a[i]==b[j]) { puts(s[j]); b[j]=-1; break; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator