POJ 3566
来源:互联网 发布:usb摄像头和网络摄像头 编辑:程序博客网 时间:2024/06/05 14:54
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 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
import java.util.*;public class Main {public static void main(String[] args) {Scanner scan=new Scanner (System.in);char a[]=new char[60];int i,j;for(i=0;i<26;i++) a[i]=(char) ('A'+i);for(j=0;j<26;j++,i++) a[i]=(char) ('a'+j);while(scan.hasNext()){int n=scan.nextInt();System.out.println(n+" "+n+" "+2);for(i=0;i<n;i++){for(j=0;j<n;j++){System.out.print(a[j]);}System.out.println();for(j=0;j<n;j++){System.out.print(a[i]);}System.out.println();if(i!=n-1) System.out.println();}}}}
- POJ 3566
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- 在Eclipse中使用Java代码调用ant出现的异常
- ios 推送
- 开启线程
- android Touch事件传递自己理解
- 相机闪存卡数据恢复方法/数码相机误删照片恢复详解
- POJ 3566
- No.10 Xcode(5.1.x) UITabBarController
- Hdu 1043
- POJ 1009 Edge Detection(模拟)
- 如何使用KeyChain保存和获取UDID
- Digital Roots——ZOJ 1115
- vc6.0与vs2010库文件添加
- C语言的本质(23)——C标准库之输入与输出(上)
- dfadfafa