Codeforces 510 A.Fox and Snake
题目链接:http://codeforces.com/contest/510/problem/A
A. Fox And Snake
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
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.
Sample test(s)
input
3 3
output
###
..#
###
input
3 4
output
####
...#
####
input
5 3
output
###
..#
###
#..
###
input
9 9
output
#########
........#
#########
#........
#########
........#
#########
#........
#########
#include <iostream>
using namespace std;
int main()
{
int m,n;
cin>>m>>n;
for(int i=1; i<=m; i++)
{
if(i % 2 ==1)
{
for(int j=1; j<=n; j++)
cout<<"#";
cout<<endl;
}
else
{
if(i % 4 == 2)
{
for(int j=1; j<n; j++)
cout<<".";
cout<<"#"<<endl;
}
if(i % 4 == 0)
{
cout<<"#";
for(int j=1; j<n; j++)
cout<<".";
cout<<endl;
}
}
}
return 0;
}
Codeforces 510 A.Fox and Snake的更多相关文章
- Codeforces 510 E. Fox And Dinner
题目链接:http://codeforces.com/problemset/problem/510/E 乍一看和那啥魔术球问题有点神似啊/XD 其实是不一样的. 解决这道问题的关键在于发现若是相邻的两 ...
- 【codeforces 510A】Fox And Snake
[题目链接]:http://codeforces.com/contest/510/problem/A [题意] 让你画一条蛇.. [题解] 煞笔提 [Number Of WA] 0 [完整代码] #i ...
- codeforces 510 C Fox And Names【拓扑排序】
题意:给出n串名字,表示字典序从小到大,求符合这样的字符串排列的字典序 先挨个地遍历字符串,遇到不相同的时候,加边,记录相应的入度 然后就是bfs的过程,如果某一点没有被访问过,且入度为0,则把它加入 ...
- 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 ...
- (CodeForces 510C) Fox And Names 拓扑排序
题目链接:http://codeforces.com/problemset/problem/510/C Fox Ciel is going to publish a paper on FOCS (Fo ...
- 找规律 Codeforces Round #290 (Div. 2) A. Fox And Snake
题目传送门 /* 水题 找规律输出 */ #include <cstdio> #include <iostream> #include <cstring> #inc ...
- Codeforces 388 D. Fox and Perfect Sets
$ >Codeforces \space 388 D. Fox and Perfect Sets<$ 题目大意 : 定义一个完美的集合 \(S\) ,当且仅当 \(S\) 非负非空,且 ...
- 【codeforces 510D】Fox And Jumping
[题目链接]:http://codeforces.com/contest/510/problem/D [题意] 你可以买n种卡片; 每种卡片的花费对应c[i]; 当你拥有了第i种卡片之后; 你可以在任 ...
- 【codeforces 510C】Fox And Names
[题目链接]:http://codeforces.com/contest/510/problem/C [题意] 给你n个字符串; 问你要怎么修改字典序; (即原本是a,b,c..z现在你可以修改每个字 ...
随机推荐
- UNIX环境高级编程--8. 进程控制
进程控制进程标识: 每一个进程都有一个非负整型表示的唯一进程ID.虽然唯一,但是ID可以复用.当一个进程结束后,其进程ID会被延迟复用. ID=0的进程通常是调度进程,常被称作交换进程(s ...
- C# 自己用到的几个参数转换方法
/// <summary> /// Method:CommandHelper /// Author:Liuyangyi /// Data:2016-05-10 /// </summa ...
- 前端-Node.js思维导图笔记
看不清的朋友右键保存或者新窗口打开哦!喜欢我可以关注我,还有更多前端思维导图笔记
- 使用WindowBuilder设计Swing程序
Swing程序表示Java的客户端窗体程序,除了通过手动编写代码的方式设计Swing程序之外,Eclipse中还提供了一种WindowBuilder工具,该工具是一种非常好用的Swing可视化开发工具 ...
- 02--SQLite操作一步到位
SQLite数据库(一):基本操作 SQLite 是一个开源的嵌入式关系数据库,实现自包容.零配置.支持事务的SQL数据库引擎. 其特点是高度便携.使用方便.结构紧凑.高效.可靠. 与其他数据库管理系 ...
- html——行内元素、块元素、行内块元素
行内元素:span ,a, ,strong , em, del, ins.特点:在一行上显示:不能直接设置宽高:元素的宽和高就是内容撑开的宽高. 块元素:div,h1-h6,p,ul,li.特 ...
- dubbo之并发控制
并发控制 配置样例 样例 1 限制 com.foo.BarService 的每个方法,服务器端并发执行(或占用线程池线程数)不能超过 10 个: <dubbo:service interface ...
- 基于python xlsxwriter、xlrd 生成测试报告
import xlsxwriter,xlrd ''' 思路: 1.获取数据 2.整合数据 3.写入文件 ''' #筛选 def filt(category,table,filt_name=None,r ...
- .net core 使用 textSharp生成pdf
引入Nuget包 using iTextSharp.text; using iTextSharp.text.pdf; using System; using System.IO; namespace ...
- Xftp 5 和 Xshell 5 基本使用方法
软件介绍: (1)Xshell: 一个强大的安全终端模拟软件,它支持SSH1, SSH2, 以及Microsoft Windows 平台的 TELNET 协议.Xshell通过互联网可以连接到远程的服 ...