Problem description

Fox Ciel starts to learn programming. The first task is drawing a fox! However, that turns out to be too hard for a beginner, so she decides to draw a snake instead.

A snake is a pattern on a n by m table. Denote c-th cell of r-th row as (r, c). The tail of the snake is located at (1, 1), then it's body extends to (1, m), then goes down 2 rows to (3, m), then goes left to (3, 1) and so on.

Your task is to draw this snake for Fox Ciel: the empty cells should be represented as dot characters ('.') and the snake cells should be filled with number signs ('#').

Consider sample tests in order to understand the snake pattern.

Input

The only line contains two integers: n and m (3 ≤ n, m ≤ 50).

n is an odd number.

Output

Output n lines. Each line should contain a string consisting of m characters. Do not output spaces.

Examples

Input

  1. 3 3

Output

  1. ###
    ..#
    ###

Input

  1. 3 4

Output

  1. ####
    ...#
    ####

Input

  1. 5 3

Output

  1. ###
    ..#
    ###
    #..
    ###

Input

  1. 9 9

Output

  1. #########
    ........#
    #########
    #........
    #########
    ........#
    #########
    #........
    #########
    解题思路:按规律输出,当i为奇数时,输出的一行全部为'#';当i为偶数时,用flag做开关,交换输出两种格式,水过!
    AC代码:
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define FOR(a,b,c) for(int i=a;i<=b;++i)printf("%c",c)
  4. int n,m;bool flag;
  5. int main(){
  6. cin>>n>>m;flag=false;
  7. for(int i=;i<=n;++i){
  8. if(i%)FOR(,m,'#');
  9. else{
  10. if(!flag){FOR(,m-,'.');cout<<'#';flag=true;}
  11. else{cout<<'#';FOR(,m,'.');flag=false;}
  12. }
  13. cout<<endl;
  14. }
  15. return ;
  16. }

A - Fox And Snake的更多相关文章

  1. Codeforces Round #290 (Div. 2) A. Fox And Snake 水题

    A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...

  2. Codeforces 510 A.Fox and Snake

    题目链接:http://codeforces.com/contest/510/problem/A A. Fox And Snake time limit per test2 seconds memor ...

  3. 找规律 Codeforces Round #290 (Div. 2) A. Fox And Snake

    题目传送门 /* 水题 找规律输出 */ #include <cstdio> #include <iostream> #include <cstring> #inc ...

  4. 【codeforces 510A】Fox And Snake

    [题目链接]:http://codeforces.com/contest/510/problem/A [题意] 让你画一条蛇.. [题解] 煞笔提 [Number Of WA] 0 [完整代码] #i ...

  5. CodeForces Round #290 Div.2

    A. Fox And Snake 代码可能有点挫,但能够快速A掉就够了. #include <cstdio> int main() { //freopen("in.txt&quo ...

  6. [LeetCode] Design Snake Game 设计贪吃蛇游戏

    Design a Snake game that is played on a device with screen size = width x height. Play the game onli ...

  7. Leetcode: Design Snake Game

    Design a Snake game that is played on a device with screen size = width x height. Play the game onli ...

  8. [DFNews] Fire-Eye与Fox IT联合推出Cryptolocker解锁网站

    Cryptolocker是臭名昭著的勒索程序,使用AES加密后密钥回传,用户除了缴纳赎金之外基本无法解密数据. 近日,知名安全公司Fire-Eye与Fox IT联合推出了针对该勒索程序的解锁网站 ht ...

  9. 在线教学、视频会议 Webus Fox(1)文本、语音、视频聊天及电子白板基本用法

    Webus Fox是基于网页的在线教学.视频会议软件,不用安装,直接使用.它提供文本.语音.视频聊天,文件共享.电子白板等功能. 1. 登录 访问 http://flash.webus.cn/#,用自 ...

随机推荐

  1. [如何在mac下使用gulp] 2. gulp模块的常用方法

    常用的gulp模块方法有: gulp.src() gulp.src('client/one.js'); //指定明确的要处理文件 gulp.src('client/*.js'); //处理client ...

  2. 洛谷——P4014 分配问题

    P4014 分配问题 题目描述 有 nn 件工作要分配给 nn 个人做.第 ii 个人做第 jj 件工作产生的效益为 c_{ij}cij​ .试设计一个将 nn 件工作分配给 nn 个人做的分配方案, ...

  3. Linux:安装CentOS 6.x和CentOS 7.x

    1,准备镜像,这里到阿里云镜像网站下载 https://opsx.alibaba.com/mirror 2,安装CentOS6.10 打开vmware workstation--> 典型--&g ...

  4. MySQL之中文乱码问题

    创建 my.ini 文件,在该文件中添加以下内容,放在安装好的mysql根路径下: [client] default-character-set=utf8 [mysql] # 设置mysql客户端默认 ...

  5. 121. Best Time to Buy and Sell Stock(动态规划)

    Say you have an array for which the ith element is the price of a given stock on day i. If you were ...

  6. 4 pandas模块,Series类

      对gtx图像进行操作,使用numpy知识 如果让gtx这张图片在竖直方向上进行颠倒.   如果让gtx这张图片左右颠倒呢?   如果水平和竖直方向都要颠倒呢?   如果需要将gtx的颜色改变一下呢 ...

  7. 关于PyQt5,在pycharm上的安装步骤及使用技巧

    前序 之前学习了一款GUI图形界面设计的Tkinter库,但是经大佬的介绍,PyQT5全宇宙最强,一脸的苦笑 毫不犹豫的选择转战PyQT5,在学习之前需要先安装一些必须程序,在一番查阅后,发现PyQt ...

  8. HDU 3401 Trade

    Trade Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. Original ID: 3401 ...

  9. CTF密码学总结

    CTF中那些脑洞大开的编码和加密 摘自:https://www.cnblogs.com/mq0036/p/6544055.html 0x00 前言 正文开始之前先闲扯几句吧,玩CTF的小伙伴也许会遇到 ...

  10. 有用的生活有关的website

    1. 如何快速download mpa3 from youtube a. google "youtube download" 2. 打开https://y2mate.com 3. ...