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 |
Re:RUNTIME ERROR数组开小了In Reply To:RUNTIME ERROR数组开小了 Posted by:xfylyh at 2011-04-11 22:47:47 > 如题 #include"stdio.h" main() { int i,j,k,n,m,sum[101],min,sign; char s[101][51]; scanf("%d%d",&n,&m); for(i=0;i<m;i++) { sum[i]=0; scanf("%s",s[i]); for(j=0;j<n-1;j++) for(k=j+1;k<n;k++) if(s[i][j]>s[i][k]) sum[i]++; } for(i=0;i<m;i++) { min=1000; for(j=0;j<m;j++) if(min>sum[j]) {min=sum[j];sign=j;} printf("%s\n",s[sign]); sum[sign]=1001; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator