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 |
哪位高人帮小弟看看这怎么情况 Output Limit Exceeded 谢了!#include<stdio.h> #define N 100 #define M 50 int main() { char a[N][M]; int n,m,b[N][2]={0},t; for(int i=0;i<N;i++) b[i][0]=i; scanf("%d %d",&n,&m); for(int i=0;i<m;i++) { scanf("%s",&a[i]); for(int j=0;j<n-1;j++) for(int x=j+1;x<n;x++) if(a[i][x]<a[i][j]) b[i][1]++; } for(int i=0;i<m-1;i++) for(int j=1;j<m-i;j++) if(b[j][1]<b[j-1][1]) { t=b[j][1]; b[j][1]=b[j-1][1]; b[j-1][1]=t; t=b[j][0]; b[j][0]=b[j-1][0]; b[j-1][0]=t; } for(int i=0;i<m;i++) printf("%s\n",a[b[i][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