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 |
直接一个数一个数的写出来的!!不知道哪错了,求解~~方法麻烦了点,但测试很多组都过了啊 ,为什么还错啊!! #include <stdio.h> #include <string.h> char map[20+10][100+10]; char temp[20+10][10+10]; int Num;//字体大小 void num(int i) { int j,k; if (i==0) { for (j=1;j<=Num;j++) { temp[0][j]='-'; temp[2*Num+2][j]='-'; } for (k=1;k<=Num;k++) { temp[k][0]='|'; temp[k][Num+1]='|'; temp[k+Num+1][0]='|'; temp[k+Num+1][Num+1]='|'; } } else if (i==1) { for (j=1;j<=Num;j++) { temp[j][Num+1]='|'; temp[j+Num+1][Num+1]='|'; } } else if (i==2) { for (j=1;j<=Num;j++) { temp[0][j]='-'; temp[Num+1][j]='-'; temp[2*Num+2][j]='-'; } for (k=1;k<=Num;k++) { temp[k][Num+1]='|'; temp[k+Num+1][0]='|'; } } else if (i==3) { for (j=1;j<=Num;j++) { temp[0][j]='-'; temp[Num+1][j]='-'; temp[2*Num+2][j]='-'; } for (k=1;k<=Num;k++) { temp[k][Num+1]='|'; temp[k+Num+1][Num+1]='|'; } } else if (i==4) { for (j=1;j<=Num;j++) { temp[Num+1][j]='-'; } for (k=1;k<=Num;k++) { temp[k][0]='|'; temp[k][Num+1]='|'; temp[k+Num+1][Num+1]='|'; } } else if (i==5) { for (j=1;j<=Num;j++) { temp[0][j]='-'; temp[Num+1][j]='-'; temp[2*Num+2][j]='-'; } for (k=1;k<=Num;k++) { temp[k][0]='|'; temp[k+Num+1][Num+1]='|'; } } else if (i==6) { for (j=1;j<=Num;j++) { temp[0][j]='-'; temp[Num+1][j]='-'; temp[2*Num+2][j]='-'; } for (k=1;k<=Num;k++) { temp[k][0]='|'; temp[k+Num+1][0]='|'; temp[k+Num+1][Num+1]='|'; } } else if (i==7) { for (j=1;j<=Num;j++) { temp[0][j]='-'; } for (j=1;j<=Num;j++) { temp[j][Num+1]='|'; temp[j+Num+1][Num+1]='|'; } } else if (i==8) { for (j=1;j<=Num;j++) { temp[0][j]='-'; temp[Num+1][j]='-'; temp[2*Num+2][j]='-'; } for (k=1;k<=Num;k++) { temp[k][0]='|'; temp[k][Num+1]='|'; temp[k+Num+1][0]='|'; temp[k+Num+1][Num+1]='|'; } } else if (i==9) { for (j=1;j<=Num;j++) { temp[0][j]='-'; temp[Num+1][j]='-'; temp[2*Num+2][j]='-'; } for (k=1;k<=Num;k++) { temp[k][0]='|'; temp[k][Num+1]='|'; temp[k+Num+1][Num+1]='|'; } } } int main() { int i,j,k,p,h,s; int tp[10]; char ch_num[10]; while (scanf("%d",&s) && s) { i=0; p=0; Num=s; scanf("%s",ch_num); while (ch_num[i]!='\0') { tp[i]=ch_num[i]-'0'; i++; } memset(map,NULL,sizeof(map)); /* for(j=i-1;j>=0;j--) printf("%d ",tp[j]); memset(temp,NULL,sizeof(temp)); num(0); for (h=0;h<2*Num+3;h++) { for (k=0;k<Num+2;k++) { printf("%c",temp[h][k]); } printf("\n"); } printf("_________________________\n"); */ for(j=0;j<=i;j++) { memset(temp,NULL,sizeof(temp)); num(tp[j]); for (h=0;h<2*Num+3;h++) { for (k=p;k<p+Num+2;k++) map[h][k]=temp[h][k-p]; } if (j==i) p+=(Num+2); else p+=(Num+3); } for (j=0;j<2*Num+3;j++) { for (k=0;k<i*(Num+3);k++) printf("%c",map[j][k]); printf("\n"); } 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