A. Fox And Snake
time limit per test
memory limit per test
input
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.
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 the snake cells should be filled with number signs ('#').
Consider sample tests in order to understand the snake pattern.
Input
n and m (3 ≤ n, m ≤ 50).
n is an odd
Output
n lines. Each line should contain a string consisting of m
Sample test(s)
input
3 3
output
### ..# ###
input
3 4
output
#### ...# ####
input
5 3
output
### ..# ### #.. ###
input
9 9
output
######### ........# ######### #........ ######### ........# ######### #........ #########
按题意模拟
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<iostream>
#include<cmath>
#include<cctype>
#include<ctime>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])
#define Lson (x<<1)
#define Rson ((x<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define MAXN (50+10)
long long mul(long long a,long long b){return (a*b)%F;}
long long add(long long a,long long b){return (a+b)%F;}
long long sub(long long a,long long b){return (a-b+(a-b)/F*F+F)%F;}
typedef long long ll;
int n,m;
int main()
{
// freopen("a.in","r",stdin);
// freopen(".out","w",stdout);
cin>>n>>m;
For(i,n)
{
if (i%2)
{
For(i,m) putchar('#');
}
else if (i%4==0)
{
putchar('#');
For(i,m-1) putchar('.');
}
else
{
For(i,m-1) putchar('.');
putchar('#');
}
printf("\n");
}
return 0;
}