When the HDU 2074 stacked basket Problem description is required, the baskets with different sizes are stacked to make the colors of the baskets staggered from the top to the bottom. This job is now going to be done by the computer. It depends on you.
The input is a three-character pair, which is, the size of the outer basket is n (n is an odd integer that satisfies 0 <n <80), the central color character, and the color character of the outer basket, both are ASCII visible characters;
Output outputs a basket pattern stacked together. The central color and the color characters of the outer basket are staggered from the inner layer. When multiple baskets are stacked, the corners of the outermost basket are always polished. The stacked baskets and stacked baskets should be separated by one line.
Sample input11 B A5 @ w
Sample output aaaaaaaaa abbbbbbbbbaabaaaaaaabaababbbbbabaababaaababaabababababaababaaababaababbbbbabaabaaaaaaabaabbbbbbbbba aaaaaaa @ WWW @ w @ WWW @@@@
C ++CodeAs follows:
# Include <iostream>
Using namespace STD;
Int main ()
{
Char a, B, T;
Int N, I, j;
Char STR [90] [90];
Int r = 0;
While (CIN> N> A> B)
{
If (r ++)
Cout <Endl;
If (n = 1)
{
Cout <A <Endl;
Continue;
}
If (N % 4 = 1)
T = A, A = B, B = T;
For (I = 0; I <n; I ++)
STR [0] [I] = B;
For (I = 1; I <= n/2; I ++)
{
Memcpy (STR [I], STR [I-1], sizeof (STR [I-1]);
For (j = I; j <n-I; j ++)
If (I % 2 = 0)
STR [I] [J] = B;
Else
STR [I] [J] =;
}
STR [0] [0] = STR [0] [n-1] = '';
For (I = 0; I <= n/2; I ++)
{
For (j = 0; j <n; j ++)
{
Cout <STR [I] [J];
}
Cout <Endl;
}
For (I = n/2-1; I> = 0; I --)
{
For (j = 0; j <n; j ++)
{
Cout <STR [I] [J];
}
Cout <Endl;
}
}
Return 0;
}