Uva1605-building for UN (construction)

Source: Internet
Author: User

There are n countries that require you to design a building and divide rooms for these n countries, requiring that the country's rooms must be interconnected, and that one room must be adjacent to each of the two countries.

Problem-solving ideas: Just beginning to think very complex, by the example to mislead, plus test instructions didn't judge, thought room adjacent must on the same floor ... I've been in this hole for a long time

Only need to design two layers, each country occupies the first tier of each row, the second floor of each column, so that both Unicom and adjacent to the

#include <cstdio> #include <cstring> #define MAXN 60char ans[maxn]= " ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ "; int main () {    int n,mark=1;    while (scanf ("%d", &n)!=eof) {        printf ("2%d%d\n", n,n);        for (int i=0;i<n;i++) {            for (int j=0;j<n;j++)                printf ("%c", Ans[i]);            printf ("\ n");        }        printf ("\ n");        for (int i=0;i<n;i++) {            for (int j=0;j<n;j++)                printf ("%c", Ans[j]);            printf ("\ n");}    }    return 0;}


Uva1605-building for UN (construction)

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.