Start: Dec, 22, 2016 18:15:00
2016年秋季学期程序设计基础第三次考试
End: Dec, 22, 2016 21:00:00
Time elapsed:
Time remaining:

Problem_ID: F
Result: Accepted
Time: 1ms
Memory: 1132kB
Author: 2016212211067
In contest: 1080

#include "stdio.h"
char ch[200][200];
int main(){
    int i,j,a,n,m,k;
	char b;
	while(~scanf("%d %c",&a,&b)){
	n=(a*4)+7;
	m=a+4;
	for(i=0;i<m;++i)
		for(j=0;j<n;++j)
			ch[i][j]=' ';
    for(i=0;i<n;++i){
		ch[0][i]='-';
	    ch[m-1][i]='-';
	}
	for(i=1;i<m-1;++i){
		ch[i][0]='|';
		ch[i][n-1]='|';
	}
	for(i=2;i<m-2;++i){
	    ch[i][2]=ch[i][1+a]=ch[i][4+2*a]=ch[i][3+3*a]=ch[i][5+3*a]=ch[i][4+4*a]=b;
	}
	for(i=2;i<1+a;++i)
	    ch[(m)/2][i]=b;
	for(i=3+a;i<3+2*a;++i){
	    ch[2][i]=b;
		ch[m-3][i]=b;
	}
	for(i=5+3*a;i<5+4*a;++i)
		ch[m-3][i]=b;
	for(i=2;i<m-3;++i){
		ch[i][4+2*a-i]=b;
		ch[i][2+2*a+i]=b;
	}
	for(i=0;i<m;++i){
		for(j=0;j<n;++j){
			printf("%c",ch[i][j]);
		}
	    printf("\n");	
	}
	}
}