Building for UN - POJ 3566 想法题
来源:互联网 发布:中大咨询怎么样知乎 编辑:程序博客网 时间:2024/06/05 16:38
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 number n (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 numbers h, w, and l — height, width and length of the building respectively.
h descriptions of floors should follow. Each floor description consists of l 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
题意:让每个国家都挨着,让你输出建造方法。
思路:一共有n层,每层有两排,第一排是1-n的国家,第二排是第n层对应第n个国家。
AC代码如下:
#include<cstdio>#include<cstring>using namespace std;int main(){ int n,i,j,k; char s[100]; for(i=1;i<=26;i++) { s[i]='A'+i-1; s[i+26]='a'+i-1; } while(~scanf("%d",&n)) { printf("%d %d 2\n",n,n); for(i=1;i<=n;i++) { if(i!=1) printf("\n"); for(j=1;j<=n;j++) printf("%c",s[j]); printf("\n"); for(j=1;j<=n;j++) printf("%c",s[i]); printf("\n"); } }}
- Building for UN - POJ 3566 想法题
- poj 3566 building for UN
- poj 3566 Building for UN(为联合国而建)
- POJ 3566 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
- Building for UN UVA
- Building for UN UVA
- Building for UN UVA
- POJ 3566 (弱校联萌十一大决战之厉兵秣马 B. Building for UN)
- 操作系统的一些基本概念
- UVA - 10410 Tree Reconstruction
- const char to LPCTSTR不能转化问题
- hdu 1312 Red and Black
- 进程通信
- Building for UN - POJ 3566 想法题
- 面向对象——异常
- DWZ ajax 处理
- No.07 Xcode(5.x) 使用SQLite
- jsp quoted with " which must be escaped when used within the value
- http://jsfiddle.net/ 在线调试网页
- elasticsearch__5__java操作之FilterBuilders构建过滤器Query
- TabSpec setIndicator (CharSequence label, Drawable icon) 图片显示不出来
- 征服 Redis + Jedis + Spring (一)—— 配置&常规操作(GET SET DEL)