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: 1096kB
Author: KrisNMstyle
In contest: 1080

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