Problem UVA1605-Building for UN

Accept: 398  Submit: 2303
Time Limit: 10000 mSec

Problem 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

Input consists of several datasets. Each of them has 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 for each dataset 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 1 000 000 offices in the building. Each office should be occupied by a country. There should be exactly n different countries in the building. In this problem the required building design always exists. Print a blank line between test cases.

 

 Sample Input

4
 

 Sample Output

2 2 2

AB

CC

zz zz

题解:水题,啥限制都没有,不要求最小,字典序之类的,随便画一画就出来了。

 #include <bits/stdc++.h>

 using namespace std;

 const int maxn = ;

 char gra[maxn][maxn], gra2[maxn][maxn];

 int main()
{
int n;
while (~scanf("%d", &n)) {
printf("%d %d %d\n", , n, n);
for (int i = ; i < n; i++) {
for (int j = ; j < n; j++) {
if(i < ) gra[i][j] = 'A' + i;
else gra[i][j] = 'a' + i - ;
}
} for (int j = ; j < n; j++) {
for (int i = ; i < n; i++) {
if(j < ) gra2[i][j] = 'A' + j;
else gra2[i][j] = 'a' + j - ;
}
} for (int i = ; i < n; i++) {
for (int j = ; j < n; j++) {
printf("%c", gra[i][j]);
}
printf("\n");
}
printf("\n");
for (int i = ; i < n; i++) {
for (int j = ; j < n; j++) {
printf("%c", gra2[i][j]);
}
printf("\n");
}
printf("\n");
}
return ;
}

UVA1605-Building for UN(思维)的更多相关文章

  1. UVa1605 - Building for UN(构造法)

    UVA - 1605 Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu Description ...

  2. UVA 1605 Building for UN(思维)

    题目链接: https://cn.vjudge.net/problem/UVA-1605#author=0 /* 问题 设计一个包含若干层的联合国大厦,其中每一层都是等大的网格,每个格子分配给一个国家 ...

  3. UVa1605,Building for UN

    我比较好奇的是uva后台是怎么测这题的 没什么可说的,那些不想敲但还是想直接交这题的直接copy过去吧 #include <iostream> #include <cstring&g ...

  4. UVA-1605 Building for UN (构造)

    题目大意:n个国家的人要在一栋大厦里办公,要求任意两个国家的办公室要相邻(同层同边或邻层同面),设计一个满足要求的方案. 题目分析:题目限制较少,任意构造出一个解即可. 代码如下: # include ...

  5. uva1605 - Building for UN(构造法)

    这道题构造出的结果很妙,考察思维能力.就两层,每层都n*n个格子,第一层第i行都放国家i,第二层第j列都放国家j. 需要注意的是ASCII中A至Z在a至z的前面(数字小),而且它们两组不挨着.所以需要 ...

  6. HDU 5538 House Building(模拟——思维)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5538 Problem Description Have you ever played the vi ...

  7. 8-2 Building for UN Uva1605

    题意:你的任务是设计一个包含若干层的联合国大楼,其中每层都是一个等大的网络 由若干个国家需要在联合国大楼里面办公 你需要把每个格子分配给一个国家 使得任意两个不同的国家都有一对相邻的格子  (要没是同 ...

  8. 【例题 8-2 UVA-1605】Building for UN

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 两层 然后n*n就够了 第一层类似 aaa.. bbb.. ccc.. ... 第二次则变成 abc.... abc.... abc ...

  9. 架构师修炼 II - 表达思维与驾驭方法论

    开篇之前我想先说说当年开发的那点事儿:大约10年前吧,我还是一个程序员的时候经常都是遇到这样的项目开发流程: 解决方案 :满足客户目的和投标用的一堆文档(不少还是互联网上抄的) ,是以Word为主的纯 ...

  10. 5 Tips for Building a Winning DevOps Culture

    对于企业来说,前途未卜的改变往往很难发生,就像航海一样,重复的往往是久经验证的安全航线,这点在DevOps文化的构建上同样如此.近日,CA Technologies的高级策略师Peter Waterh ...

随机推荐

  1. 创建Aurelia项目

    什么是Aurelia? Aurelia 是一个新的开源的,基于web标准的mvvm框架,是一个现代化的js模块的集合. Aurelia提供了丰富的plugin,例如国际化,验证,模态框,UI可视化等. ...

  2. 构造方法为private与类修饰符为final

    构造方法为private的:在这个类外1:不能继承这个类2:不能用new来产生这个类的实例 在这个类内:1:可以继承这个类2:可以用new来产生这个类的实例 类修饰符为final的:在这个类外1:不能 ...

  3. javascript对象与方法

    对象与方法 一.数组(Array) 1.使用new关键字创建数组 var box = new Array();                                     //创建了一个数 ...

  4. TCP 三次握手与四次断开

    三次握手建立连接 TCP连接是通过三次握手来连接的. 第一次握手 当客户端向服务器发起连接请求时,客户端会发送同步序列标号SYN到服务器,在这里我们设SYN为x,等待服务器确认,这时客户端的状态为SY ...

  5. 19 个常用的 JavaScript 简写方法

    来自:SangSir 链接:https://segmentfault.com/a/1190000012673854 原文:https://www.sitepoint.com/shorthand-jav ...

  6. Tsung MQTT协议简介及MQTT xml文档配置介绍

    MQTT协议简介及MQTT xml文档配置介绍 by:授客 QQ:1033553122 1. MQTT协议介绍 MQTT(Message Queuing Telemetry Transport,消息队 ...

  7. 取消IE、Office、Wmp首次开启提示

    一.取消IE首次开启提示 1.运行框输入gpedit.msc.打开组策略配置 2.本地计算机策略-计算机配置-管理模板-windows组件-Internet Explorer,查找右边“阻止执行首次运 ...

  8. MySQL针对对账数据,每天每个店只能产生一条对账记录,对数据库数据进行添加联合唯一索引设置

    ALTER TABLE StoreDailyCheck ADD UNIQUE INDEX(StoreId,CheckDate);

  9. (后端)SpringMVC提交数组时不能超过256个值(转)

    项目遇到了这个错误,spring mvc 竟然还有这个漏洞. org.springframework.beans.InvalidPropertyException: Invalid property ...

  10. JHipster生成单体架构的应用示例

    本文演示如何用JHipster生成一个单体架构风格的应用. 环境需求:安装好JHipster开发环境的CentOS 7.4(参考这里) 应用名:app1 实体名:role 主机IP:192.168.2 ...