Stacked Basket
Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 14556 Accepted Submission (s): 3784
Problem description need, the size of a circle of the basket stacked up, so that from the top down when looking at the side baskets of color staggered. The work now needs to be done by the computer, which depends on you.
Input is a ternary group, respectively, the outer basket size n (n to meet the 0<n<80 of odd integers), Central color characters, outer basket color characters, both of which are ASCII visible characters;
Output outputs stacked with the basket pattern, the center suit and the outer basket color characters from the inner layer staggered overlapping, multi-basket stack, the outer corner of the basket is always polished off. There should be a line between the stacked basket and the stacking basket.
Sample Input11 B A5 @ W
Sample Output AAAAAAAAA Abbbbbbbbbaabaaaaaaabaababbbbbabaababaaababaabababababaababaaababaababbbbbabaabaaaaaaabaabbbbbbbbba AAAAAAAAA @@ @ @[email protected]@[email Protected]@@[email protected] @@@1, take into account the situation of N==1 2, note that there is a blank line between each of the two sets of outputs
#include <stdio.h> #include <string.h> #define MAX 110char s[max][max];int main () {int N,m,j,i,t;char a,b,c; int Ok=0;while (scanf ("%d%c", &n,&a,&b)!=eof) {if (OK) printf ("\ n"); Ok=1;if (n==1) {printf ("%c\n", a); Continue;} memset (S, ' n ', sizeof (s)), m= (n+1)/2-1;s[m][m]=a;for (i=1;i<=m;i++) {if (i&1) C=b;else c=a;for (j=m-i;j<=m+i ; j + +) {s[m-i][j]=c;s[m+i][j]=c;s[j][m-i]=c;s[j][m+i]=c;}} s[0][0]= '; s[0][n-1]= '; s[n-1][0]= '; s[n-1][n-1]= '; for (i=0;i<n;i++) {
Hdoj 2074 Stacked Baskets