叠筐
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 17006 Accepted Submission(s): 4421
Problem Description
需要的时候,就把一个个大小差一圈的筐叠上去,使得从上往下看时,边筐花色交错。这个工作现在要让计算机来完成,得看你的了。
Input
输入是一个个的三元组,分别是,外筐尺寸n(n为满足0<n<80的奇整数),中心花色字符,外筐花色字符,后二者都为ASCII可见字符;
Output
输出叠在一起的筐图案,中心花色与外筐花色字符从内层起交错相叠,多筐相叠时,最外筐的角总是被打磨掉。叠筐与叠筐之间应有一行间隔。
Sample Input
11 B A 5 @ W
Sample Output
AAAAAAAAA
ABBBBBBBBBA
ABAAAAAAABA
ABABBBBBABA
ABABAAABABA
ABABABABABA
ABABAAABABA
ABABBBBBABA
ABAAAAAAABA
ABBBBBBBBBA
AAAAAAAAA
@@@
@WWW@
@W@W@
@WWW@
@@@
Author
qianneng
Source
Recommend
linle | We have carefully selected several similar problems for you:
#includeusing namespace std;int main(){ int n; const int N = 81; char graph[3]; char G[N][N]; int Q=0; while(scanf("%d %c %c", &n, &graph[0], &graph[1]) != EOF) { if(Q !=0) printf("\n"); if(n==1) { Q++; printf("%c\n", graph[0]); continue; } int cnt= 0; int x=0, y=0; int id=n/2%2; char ch=graph[id] ; //printf("%d\n", id); for(int i=0; i< n/2+1; i++) { int start= 0+cnt, end =n-cnt; for(int i=start; i< end; i++) { G[cnt][i]= ch; G[i][cnt]= ch; G[n-cnt-1][i]= ch; G[i][n-cnt-1]= ch; } id= (id==1? 0:1); ch= graph[id]; cnt++; } G[0][0]=' '; G[0][n-1]=' '; G[n-1][0]=' '; G[n-1][n-1]=' '; for(int i=0; i