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 |
帮忙看看啊,VC运行成功了,但就是WA啊!#include<stdio.h> #include<string.h> int main() { char dna[100][51],tem[51]; int i,j,k,m,n,a[51]={0},tem1; scanf("%d %d",&n,&m); getchar(); for(k=0;k<m;k++) { gets(dna[k]); for(i=0;i<n-1;i++) { for(j=i+1;j<n;j++) { if(dna[k][i]>dna[k][j]) a[k]++; } } } for(i=0;i<m-1;i++) { for(j=i+1;j<m;j++) { if(a[i]>a[j]) { tem1=a[i]; a[i]=a[j]; a[j]=tem1; strcpy(tem,dna[i]); strcpy(dna[i],dna[j]); strcpy(dna[j],tem); } } } for(i=0;i<m;i++) puts(dna[i]); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator