POJ 3566 Building for UN (无脑构造 水题)
来源:互联网 发布:java split用法 空格 编辑:程序博客网 时间:2024/06/05 10:12
Description
The United Nations has decided to build a new headquarters in Saint Petersburg, Russia. It will have a form of a rectangular parallelepiped and will consist of several rectangular floors, one on top of another. Each floor is a rectangular grid of the same dimensions, each cell of this grid is an office.
Two offices are considered adjacent if they are located on the same floor and share a common wall, or if one’s floor is the other’s ceiling.
The St. Petersburg building will host n national missions. Each country gets several offices that form a connected set.
Moreover, modern political situation shows that countries might want to form secret coalitions. For that to be possible, each pair of countries must have at least one pair of adjacent offices, so that they can raise the wall or the ceiling they share to perform secret pair-wise negotiations just in case they need to.
You are hired to design an appropriate building for the UN.
Input
The input file consists of a single integer numbern (1 ≤ n ≤ 50) — the number of countries that are hosted in the building.
Output
On the first line of the output file write three integer numbersh, w, and l — height, width and length of the building respectively.
h descriptions of floors should follow. Each floor description consists ofl lines with w characters on each line. Separate descriptions of adjacent floors with an empty line.
Use capital and small Latin letters to denote offices of different countries. There should be at most
Sample Input
4
Sample Output
2 2 2ABCCzzzz
Source
题目链接:http://poj.org/problem?id=3566
题目大意:用大写或小写字母表示一个国家的所有房间,有n个国家,要求任意两个国家至少有一个房间相邻(上下左右前后6个方向),每个国家自己所有的房间要是一个连通集合,求可行的构造方案
题目分析:在纸上画画即可
#include <cstdio>char ans[100] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";int main(){ int n; 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"); } }}
- POJ 3566 Building for UN (无脑构造 水题)
- poj 3566 building for UN
- Building for UN - POJ 3566 想法题
- UVa1605 - Building for UN(构造)
- UVA1605 Building for UN (构造)
- UVa1605 Building for UN 构造
- poj 3566 Building for UN(为联合国而建)
- uva 1605 Building for UN 构造?随意
- UVA - 1605 Building for UN 水题
- B - Building for UN
- 1605 - Building for UN
- 1605 - Building for UN
- UVA1605-Building for UN
- Building for UN
- UVA_1605: Building for UN
- 1605 - Building for UN
- Building for UN
- UVa1605 Building for UN
- leetcode 035 Search Insert Position
- 数据库入门
- 1005. Spell It Right (20)
- WinCE Socket的陷阱
- ViewController的加载的生命周期
- POJ 3566 Building for UN (无脑构造 水题)
- 网络封包过滤之分层服务提供者(LSP)
- 二元数组中的指针
- 【Qt】QTableView表格滚动条样式实现QStyleSheet
- webstorm 快捷键
- 多对一单向关联关系理解与实践
- gcc的三个阶段
- 你知道Parallels desktop使用方法吗
- nyoj The Triangle 18 (简单DP)