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 |
What's wrong??Thank you.#include "math.h" #include "stdio.h" void main() { char a[100][52]; int time,lenth,i,j,k,l,min; scanf("%d %d\n",&lenth,&time); for (i=0;i<time;i++) { for (j=0;(a[i][j]=getchar())!='\n';j++) {} a[i][51]=0; for (k=0;k<lenth-1;k++) { for(l=k+1;l<lenth;l++) { if (a[i][k]>a[i][l]) a[i][51]++; } } } for(i=0;i<time;i++) { min=i; for(j=i+1;j<time;j++) { if (a[i][51]>a[j][51]) min=j; } for(k=0;k<lenth;k++) { printf("%c",a[min][k]); a[min][k]=a[i][k]; } a[min][51]=a[i][51]; printf("\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator