码迷,mamicode.com
首页 > 其他好文 > 详细

UVa1605 Building for UN (构造法)

时间:2016-09-11 18:33:56      阅读:371      评论:0      收藏:0      [点我收藏+]

标签:

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

标签:

原文地址:http://www.cnblogs.com/XieWeida/p/5862296.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!