题目1432：叠筐

11 B A
5 @ W

 AAAAAAAAA
ABBBBBBBBBA
ABAAAAAAABA
ABABBBBBABA
ABABAAABABA
ABABABABABA
ABABAAABABA
ABABBBBBABA
ABAAAAAAABA
ABBBBBBBBBA
AAAAAAAAA

@@@
@WWW@
@W@W@
@WWW@
@@@
#include <iostream>
#include<stdio.h>
using namespace std;

int main()
{
int outputbuf[82][82];
char a,b;
int n;
bool firstcase=true;
while(scanf("%d %c %c",&n,&a,&b)==3)
{
if(firstcase==true)
{
firstcase=false;
}
else
{
printf("\n");
}
for(int i=1,j=1; i<=n; i+=2,j++)
{
int x=n/2+1,y=x;
x-=j-1;
y-=j-1;
char c=j%2==1?a:b;
for(int k=1; k<=i; k++)//K代表圈的长度
{
outputbuf[x+k-1][y]=c;//左边赋值
outputbuf[x][y+k-1]=c;//上边赋值
outputbuf[x+i-1][y+k-1]=c;//右边赋值
outputbuf[x+k-1][y+i-1]=c;//下边赋值
}
}
if(n!=1)
{
outputbuf[1][1]=' ';
outputbuf[n][1]=' ';
outputbuf[1][n]=' ';
outputbuf[n][n]=' ';
}
for(int i=1; i<=n; i++)
{
for(int j=1; j<=n; j++)
{
printf("%c",outputbuf[i][j]);
}
printf("\n");
}

}
return 0;
}

叠筐问题 HDU 2074

2016-08-16 18:55:26

九度Online Judge 题目1432：叠筐 解答

2016-04-12 20:21:21

叠筐

2016-01-27 11:26:44

ACM整理（二）——1432叠筐

2014-08-29 17:56:12

杭电2074叠筐

2015-08-07 20:56:37

题目15：叠筐

2013-03-01 17:59:11

2074 叠筐

2014-07-10 15:27:02

hdu-oj 2074 叠筐

2014-08-04 21:30:42

水题堆2.O - 叠筐

2018-02-15 16:31:35

九度OJ 题目1432：叠筐

2016-01-22 18:58:52