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 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 Input
3 3
Sample Output
..#
Hint
题意
让你画出n*m的弯道,一直转弯的那种
题解:
水题,模拟一下就好了
代码
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m;scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(i%2==1)
printf("#");
else if(i%4==2&&j==m)
printf("#");
else if(i%4==0&&j==1)
printf("#");
else printf(".");
}
printf("\n");
}
}
Codeforces Round #290 (Div. 2) A. Fox And Snake 水题的更多相关文章
- 找规律 Codeforces Round #290 (Div. 2) A. Fox And Snake
题目传送门 /* 水题 找规律输出 */ #include <cstdio> #include <iostream> #include <cstring> #inc ...
- Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题
Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec Memory Limit: 256 MBSubmit: xxx ...
- Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题
A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...
- Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题
B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...
- Codeforces Round #368 (Div. 2) A. Brain's Photos 水题
A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...
- Codeforces Round #359 (Div. 2) A. Free Ice Cream 水题
A. Free Ice Cream 题目连接: http://www.codeforces.com/contest/686/problem/A Description After their adve ...
- Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题
A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...
- Codeforces Round #290 (Div. 2) D. Fox And Jumping dp
D. Fox And Jumping 题目连接: http://codeforces.com/contest/510/problem/D Description Fox Ciel is playing ...
- Codeforces Round #290 (Div. 2) C. Fox And Names dfs
C. Fox And Names 题目连接: http://codeforces.com/contest/510/problem/C Description Fox Ciel is going to ...
随机推荐
- SPF详解2
什么是SPF? 这里的SPF不是防晒指数,而是指Sender Policy Framework.翻译过来就是发信者策略架构,比较拗口,通常都直接称为SPF. SPF是跟DNS相关的一项技术,它 ...
- 【C++】统计代码覆盖率(二)
嗷嗷嗷!!!好激动,我好蠢.不过最后还是解决了.呜呜呜 有些都是东一块西一块查的,如果有侵权欢迎私信我,我注明出处. 一 gcov&CMake 昨天试了下测试代码和被测代码都是c++的情况,直 ...
- LR录制测试脚本
1.录制的业务流程 2.录制脚本 3.查看脚本
- cocos2dx 内存管理的理解
关于引擎内存管理的细节,网上有大量的详解,这里概括一下: cocos2d-x 的世界是基于 CCObject 类构建的,所以内存管理的本质就是管理一个个 CCObject. //CCObject 内部 ...
- Juniti学习总结
JUnit简介 JUnit是由 Erich Gamma和Kent Beck编写的一个回归测试框架(regression testing framework).JUnit测试是程序员测试,即所谓白盒测试 ...
- Github在windows7环境下使用入门
1.下载并安装 下载和安装一般都没什么问题,网上的链接一大堆,不过还是在此给一个安装的地址和安装的参考吧. 当然,安装完成后要保证git能使用,必须配置github 2.配置github 首先是要创建 ...
- [Android][Audio] audio_policy.conf文件分析
不同的Android产品在音频的设计上通常是存在差异的,而这些差异可以同过Audio的配置文件audio_policy.conf来获得.在Android系统中音频配置文件存放路径有两处,存放地址可以从 ...
- CSStickyHeaderFlowLayout collectionView headerView 悬浮
github:https://github.com/levyleo/CSStickyHeaderFlowLayout iOS 10 使用时会出现崩溃:https://github.com/CSStic ...
- 轻松学习Linux之认识Shell
Shell是一个命令解释器提供了用户与内核进行交互操作的一种接口shell,编程对於系统管理员或是一般使用者都相当有用,除了自动化,还可写出一些有趣的小工具,Linux本身有各种版本一 ...
- NativeInt
NativeInt ni = 100; //Wrong. Will issue an Error NativeInt ni = NativeInt(100); //Correct System::Ge ...