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

  1. 7 2

Output

  1. YES
  2. .......
  3. .#.....
  4. .#.....
  5. .......

Input

  1. 5 3

Output

  1. YES
  2. .....
  3. .###.
  4. .....
  5. .....

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

代码:

  1. #include<cstdio>
  2. #include<iostream>
  3. #include<cstring>
  4. #include<algorithm>
  5. #include<queue>
  6. #include<stack>
  7. #include<set>
  8. #include<map>
  9. #include<vector>
  10. #include<cmath>
  11. const int maxn=3e5+5;
  12. typedef long long ll;
  13. using namespace std;
  14. char Map[5][105];
  15. int n,k;
  16. void init()
  17. {
  18. for(int t=0;t<4;t++)
  19. {
  20. for(int j=0;j<n;j++)
  21. {
  22. Map[t][j]='.';
  23. }
  24. }
  25. }
  26. int main()
  27. {
  28. cin>>n>>k;
  29. init();
  30. if(k%2==0)
  31. {
  32. int s=k/2;
  33. for(int t=1;t<s+1;t++)
  34. {
  35. Map[1][t]='#';
  36. }
  37. for(int t=1;t<s+1;t++)
  38. {
  39. Map[2][t]='#';
  40. }
  41. cout<<"YES"<<endl;
  42. for(int t=0;t<4;t++)
  43. {
  44. puts(Map[t]);
  45. }
  46. }
  47. else
  48. {
  49. int s=n/2;
  50. Map[1][s]='#';
  51. k--;
  52. for(int t=1;t<n/2;t++)
  53. {
  54. if(k==0)
  55. {
  56. break;
  57. }
  58. else
  59. {
  60. Map[1][t]='#';
  61. Map[1][n-1-t]='#';
  62. k-=2;
  63. }
  64. }
  65. for(int t=1;t<n/2;t++)
  66. {
  67. if(k==0)
  68. {
  69. break;
  70. }
  71. else
  72. {
  73. Map[2][t]='#';
  74. Map[2][n-1-t]='#';
  75. k-=2;
  76. }
  77. }
  78. cout<<"YES"<<endl;
  79. for(int t=0;t<4;t++)
  80. {
  81. puts(Map[t]);
  82. }
  83. }
  84. return 0;
  85. }

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. dojo模块化开发

    转自https://www.cnblogs.com/sharpest/p/6242801.html

  2. mybatis spring 框架整合

    driver=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/test user=LF password=LF <?xml versi ...

  3. 微信WeixinJSBridge API 屏蔽右上角分享等常用方法

    WeixinJSBridge这个API有几个功能还是相当有用的,比如: 1.隐藏微信网页右上角的按钮(...按钮):开发者可以用这个功能来禁止当前页面被分享 2.隐藏微信网页底部的导航栏(比如前进后退 ...

  4. getopt两个模块getopt 和gun_getopt 的异同

    getopt的两个模块getopt和gun_getopt都可以接收参数,但是又有不同; 先看 getopt.getopt这个模块: import sys import getopt def main( ...

  5. UOJ#22. 【UR #1】外星人

    传送门 分析 我们发现一个很神的性质,就是对于一个数如果放在它之前的数小于它那它一定对答案没有贡献 于是我们用dp[i][j]表示从大往小考虑了前i个数,当前答案是j的方案数 我们知道它由两种情况转移 ...

  6. c# 获取非托管指针长度

    public List<string> GetPDFValues() { List<string> strs = new List<string>(); unsaf ...

  7. Codeforces 427E Police Patrol

    找中间的数,然后从两头取. #include<stdio.h> ; int pos[MAX]; int main() { int n,m,tmp; int i; int pol; long ...

  8. 单元测试NUnit 的文章

    请参考 https://www.cnblogs.com/ranh941/p/7629279.htmlhttps://blog.csdn.net/qincode/article/details/1831 ...

  9. sublime text3安装后html:5+Tab不能快速生成html头部信息的解决办法

    sublime text3安装后html:5+Tab不能快速生成html头部信息的解决办法: 需要下载Emmet插件,按网上写的步骤按ctrl+shift+P打开命令面板,输入install,鼠标点击 ...

  10. App测试从入门到精通之交叉事件测试

    交叉事件测试又叫事件或者叫冲突测试.对于正在运行的应用,若进入短信,电话等其他软件响应的情况,不会影响所测试应用,且会保证应用都能正确运行.下面我来看一下关于交叉测试中,我们测试人员需要考虑的一些测试 ...