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是对的,结果却是wrong answer呢?呜,哪位大侠能普渡一下。#include<stdio.h> void main() { char a[100][50]; int i,j,k,aa[100],m,n,aaa[100]; scanf("%d %d",&n,&m); for(i=0;i<m;i++) { scanf("%s",a[i]); aa[i]=0; aaa[i]=i; } for(i=0;i<m;i++) for(j=0;j<n-1;j++) for(k=j+1;k<n;k++) if(a[i][j]>a[i][k]) aa[i]++; for(i=0;i<m-1;i++) for(j=i+1;j<m;j++) if(aa[i]>aa[j]) { k=aa[i]; aa[i]=aa[j]; aa[j]=k; k=aaa[i]; aaa[i]=aaa[j]; aaa[j]=k; } for(i=0;i<m;i++) { k=aaa[i]; printf("%s\n",a[k]); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator