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啊?找了好久了,哪个大牛帮我看看啊!(附代码)#include<stdio.h> #include<string.h> #include <stdlib.h> char s[105][65]; int cmp(const void *a,const void *b) { return(strcmp((char*)a,(char*)b)); } int main() { int b,i,j,k,n,max,ii,bb,kk; while(scanf("%d",&n)!=EOF) { getchar(); b=0; for(i=0;i<n;i++) { gets(s[i]); k=strlen(s[i]); if(b<k) b=k; } b+=2; qsort(s,n,sizeof(s[0]),cmp); kk=(int)60/b; ii=n/kk; if(ii*k<n) ii++; printf("------------------------------------------------------------\n"); for(i=0;i<ii;i++) for(j=0;j<kk;j++) { printf("%s",s[i+j*ii]); if((i+j*ii)==n-1) { printf("\n"); break; } if(j<kk-1) { bb=strlen(s[i+j*ii]); bb=b-bb; for(k=0;k<bb;k++) printf(" "); } else printf("\n"); } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator