UVA - 1605 Building for UN (联合国大楼)
2024-09-03 22:33:45
题意:一个联合国大楼每层都有数量相等大小相同的格子,将其分配给n个国家,使任意两个不同的国家都相邻(同层有公共边或相邻层的同一个格子)。
分析:可以设计一个只有两层的大楼,第一层每个国家占一行,第二层每个国家占一列,即每层都是n*n的。
#pragma comment(linker, "/STACK:102400000, 102400000")
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<iostream>
#include<sstream>
#include<iterator>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<list>
#define Min(a, b) ((a < b) ? a : b)
#define Max(a, b) ((a < b) ? b : a)
typedef long long ll;
typedef unsigned long long llu;
const int INT_INF = 0x3f3f3f3f;
const int INT_M_INF = 0x7f7f7f7f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const ll LL_M_INF = 0x7f7f7f7f7f7f7f7f;
const int dr[] = {, , -, , -, -, , };
const int dc[] = {-, , , , -, , -, };
const int MOD = 1e9 + ;
const double pi = acos(-1.0);
const double eps = 1e-;
const int MAXN = + ;
const int MAXT = + ;
using namespace std;
map<int, char> mp;
void init(){
string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
for(int i = ; i < ; ++i){
mp[i] = s[i];
}
}
int main(){
int n;
init();
bool flag = true;
while(scanf("%d", &n) == ){
if(flag) flag = false;
else printf("\n");
printf("2 %d %d\n", n, n);
for(int i = ; i < n; ++i){
for(int j = ; j < n; ++j){
printf("%c", mp[i]);
}
printf("\n");
}
printf("\n");
for(int i = ; i < n; ++i){
for(int j = ; j < n; ++j){
printf("%c", mp[j]);
}
printf("\n");
}
}
return ;
}
最新文章
- WPF 无边框透明按钮
- 关于C语言的一些trick
- iOS中编写单例类的心得
- yaf框架使用(centos6.5)
- WebApp 里Meta标签大全,webappmeta标签大全
- android怎么连接sqlite数据库?
- java的nio之:java的nio系列教程之Scatter/Gather
- 什么是struts2?
- Maven学习:常用mvn命令
- 迷宫城堡--HDOJ 1269(Tarjan)
- Java编程-第一个Java程序
- 编写可维护的JS 06
- 感觉Release有时比Debug要健壮
- ACE工具概述
- DuelJS 介绍
- Java中JDK和JRE的区别是什么?它们的作用分别是什么?
- Java动态代理机制研读
- ubuntu 安装 mkfs.ubifs
- linux系统编程之进程(六):父进程查询子进程的退出,wait,waitpid
- Python3 循环语句
热门文章
- PAT B1019/A1069 数字黑洞
- centos7 bond双网卡
- JavaScript--选择器
- JDBC--获取数据库连接
- 104、Java中String类之使用indexOf()等功能查找
- gitlab导入备份数据
- I2S 总线学习:2-I2S驱动WM8978
- msf生成软件
- 小程序真机上报错 for developer: some selectors are not allowed in component wxss , including tag name selectors, id selectors, and attribute selectors
- nuxt.js 初始化 npm run dev 报错