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 |
帮我看看为什么RUNTIME ERROR!!#include <stdio.h> #include <string.h> int main() { char str[51][101]; char temp[51]; int sum[51]; int k,m,i,j,n,t; scanf("%d%d",&n,&m); for (i=0;i<m;i++) sum[i]=0; for (k=0;k<m;k++) { scanf("%s",&str[k]); for (i=0;i<n;i++) for (j=i;j<n;j++) if (str[k][i]>str[k][j]) sum[k]++; } for (i=0;i<m;i++) for (j=i+1;j<m;j++) if (sum[i]>sum[j]) { strcpy(temp,str[i]); strcpy(str[i],str[j]); strcpy(str[j],temp); t=sum[i]; sum[i]=sum[j]; sum[j]=t; } for (i=0;i<m;i++) printf("%s\n",str[i]); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator