首页 > 代码库 > UVa1605 Building for UN (构造法)

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 (构造法)