The city of Fishtopia can be imagined as a grid of 44 rows and an odd number of columns. It has two main villages; the first is located at the top-left cell (1,1)(1,1), people who stay there love fishing at the Tuna pond at the bottom-right cell (4,n)(4,n). The second village is located at (4,1)(4,1) and its people love the Salmon pond at (1,n)(1,n).

The mayor of Fishtopia wants to place kk hotels in the city, each one occupying one cell. To allow people to enter the city from anywhere, hotels should not be placed on the border cells.

A person can move from one cell to another if those cells are not occupied by hotels and share a side.

Can you help the mayor place the hotels in a way such that there are equal number of shortest paths from each village to its preferred pond?

Input

The first line of input contain two integers, nn and kk (3≤n≤993≤n≤99, 0≤k≤2×(n−2)0≤k≤2×(n−2)), nn is odd, the width of the city, and the number of hotels to be placed, respectively.

Output

Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO".

If it is possible, print an extra 44 lines that describe the city, each line should have nn characters, each of which is "#" if that cell has a hotel on it, or "." if not.

Examples

Input

7 2

Output

YES
.......
.#.....
.#.....
.......

Input

5 3

Output

YES
.....
.###.
.....
.....

如何去看这个题,可以把他看成关于对称的图形,上下对称和左右对称

代码:

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
#include<cmath> const int maxn=3e5+5;
typedef long long ll;
using namespace std; char Map[5][105];
int n,k;
void init()
{
for(int t=0;t<4;t++)
{
for(int j=0;j<n;j++)
{
Map[t][j]='.';
}
}
}
int main()
{
cin>>n>>k;
init();
if(k%2==0)
{
int s=k/2;
for(int t=1;t<s+1;t++)
{
Map[1][t]='#';
}
for(int t=1;t<s+1;t++)
{
Map[2][t]='#';
}
cout<<"YES"<<endl;
for(int t=0;t<4;t++)
{
puts(Map[t]);
}
}
else
{
int s=n/2;
Map[1][s]='#';
k--; for(int t=1;t<n/2;t++)
{
if(k==0)
{
break;
}
else
{ Map[1][t]='#';
Map[1][n-1-t]='#';
k-=2;
}
}
for(int t=1;t<n/2;t++)
{
if(k==0)
{
break;
}
else
{ Map[2][t]='#';
Map[2][n-1-t]='#';
k-=2;
}
}
cout<<"YES"<<endl;
for(int t=0;t<4;t++)
{
puts(Map[t]);
}
} return 0;
}

Marlin (思维)的更多相关文章

  1. CF980B Marlin 构造 思维 二十四

    Marlin time limit per test 1 second memory limit per test 256 megabytes input standard input output ...

  2. [C#][算法] 用菜鸟的思维学习算法 -- 马桶排序、冒泡排序和快速排序

    用菜鸟的思维学习算法 -- 马桶排序.冒泡排序和快速排序 [博主]反骨仔 [来源]http://www.cnblogs.com/liqingwen/p/4994261.html  目录 马桶排序(令人 ...

  3. Photoshop、Illustrator思维导图笔记

    半年前学习Photoshop时记得的思维导图笔记,可能不是很全,常用的基本都记下了.

  4. CYQ.Data 从入门到放弃ORM系列:开篇:自动化框架编程思维

    前言: 随着CYQ.Data 开始回归免费使用之后,发现用户的情绪越来越激动,为了保持这持续的激动性,让我有了开源的念头. 同时,由于框架经过这5-6年来的不断演进,以前发的早期教程已经太落后了,包括 ...

  5. 计算机程序的思维逻辑 (8) - char的真正含义

    看似简单的char 通过前两节,我们应该对字符和文本的编码和乱码有了一个清晰的认识,但前两节都是与编程语言无关的,我们还是不知道怎么在程序中处理字符和文本. 本节讨论在Java中进行字符处理的基础 - ...

  6. 计算机程序的思维逻辑 (29) - 剖析String

    上节介绍了单个字符的封装类Character,本节介绍字符串类.字符串操作大概是计算机程序中最常见的操作了,Java中表示字符串的类是String,本节就来详细介绍String. 字符串的基本使用是比 ...

  7. 计算机程序的思维逻辑 (31) - 剖析Arrays

    数组是存储多个同类型元素的基本数据结构,数组中的元素在内存连续存放,可以通过数组下标直接定位任意元素,相比我们在后续章节介绍的其他容器,效率非常高. 数组操作是计算机程序中的常见基本操作,Java中有 ...

  8. 计算机程序的思维逻辑 (33) - Joda-Time

    Joda-Time上节介绍了JDK API中的日期和时间类,我们提到了JDK API的一些不足,并提到,实践中有一个广泛使用的日期和时间类库,Joda-Time,本节我们就来介绍Joda-Time.俗 ...

  9. 计算机程序的思维逻辑 (53) - 剖析Collections - 算法

    之前几节介绍了各种具体容器类和抽象容器类,上节我们提到,Java中有一个类Collections,提供了很多针对容器接口的通用功能,这些功能都是以静态方法的方式提供的. 都有哪些功能呢?大概可以分为两 ...

随机推荐

  1. Servlet和JSP简述

    什么是Servlet和JSP 用Java开发Web应用程序时用到的技术主要有两种,即Servlet和JSP. Servlet是在服务器端执行的Java程序,一个被称为Servlet容器的程序(其实就是 ...

  2. Django--static静态文件引用

    需求 引用静态文件的目录不写死 "django.core.context_processors.static", html引用 1 <script src="{{ ...

  3. Django框架 之 数据库与ORM

    浏览目录 数据库的配置 ORM表模型 ORM之增(create,save) ORM之删(delete) ORM之改(update和save) ORM之查(filter,value) 一.数据库的配置 ...

  4. K860i的109升级需要的PinyinIME.apk和QuickSearchBox.apk两个文件

    联想K860i的109版本终于可以正常更新了,感谢下乐Phone之家的蚊子咬(http://bbs.lephone.cc/space-uid-6410.html)提供了关键的两个文件:PinyinIM ...

  5. ORACLE-1:虚拟列影响alter修改表字段操作!

    一.问题: 昨天想要修改Oracle数据库中某张表的某个字段,发现怎么都修改不成功!!!并给出了如下提示: ORA-54031:要删除或修改的列由某个虚拟列表达式使用 二.啥是“虚拟列” [不可见的列 ...

  6. 查询某张表被哪些存储过程或者视图用到的sql语句

    /*查询某张表被哪些存储过程或者视图用到的sql语句*/select distinct object_name(id) from syscomments where id in (select id ...

  7. BZOJ 4034[HAOI2015]树上操作(树链剖分)

    Description 有一棵点数为 N 的树,以点 1 为根,且树点有边权.然后有 M 个操作,分为三种:操作 1 :把某个节点 x 的点权增加 a .操作 2 :把某个节点 x 为根的子树中所有点 ...

  8. 中国城市 json

    点击查看完整代码,再点击复制即可复制代码. 三级json,省市区: [{ "value": "110000", "text": " ...

  9. 一个Sql备注

    ;WITH CTE AS ( SELECT [RGTCID] ,ltrim(rtrim(T.N.value('.','varchar(100)'))) as Querystr FROM [R_GT_C ...

  10. Markdown使用心得

    1. 标题的使用 在使用标题时,如果为了层次清晰,可以在"#"后加上"1. "或者"1.1. "这种序号. 每一级标题的正文结束后,最好加一 ...