Hdoj 2074 Stacked Baskets

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.