UVa1605 Building for UN (构造法)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UVa1605 Building for UN (构造法)相关的知识,希望对你有一定的参考价值。

链接:http://vjudge.net/problem/51167

分析:

2 2 2 
AB
CC

zz
zz

2 8 8
aaaaaaaa
bbbbbbbb
cccccccc
dddddddd
eeeeeeee
ffffffff
gggggggg
hhhhhhhh

abcdefgh
abcdefgh
abcdefgh
abcdefgh
abcdefgh
abcdefgh
abcdefgh
abcdefgh


 1 #include <cstdio>
 2 
 3 int n;
 4 
 5 int main() {
 6     while (scanf("%d", &n) == 1) {
 7         printf("2 %d %d\n", n, n);
 8         for (int i = 0; i < n; i++) {
 9             for (int j = 0; j < n; j++)
10                 putchar(i < 26 ? a + i : A + i - 26);
11                 printf("\n");
12         }
13 
14         printf("\n");
15         for (int i = 0; i < n; i++) {
16             for (int j = 0; j < n; j++)
17                 putchar(j < 26 ? a + j : A + j - 26);
18                 printf("\n");
19         }
20         printf("\n");
21     }
22     return 0;
23 }

 

以上是关于UVa1605 Building for UN (构造法)的主要内容,如果未能解决你的问题,请参考以下文章

UVa 1605 - Building for UN

例题 8-2 UVA-1605Building for UN

UVA - 1605 Building for UN (联合国大楼)

UVA11039-Building designing

UVa 11039 Building designing (贪心+排序+模拟)

[UVA - 11039] Building designing 题解