300445: CF85A. Domino

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Domino

题意翻译

**题意简述** 你要用 $1\times 2$ 的多米诺骨牌铺满一个 $4\times n$ 的矩阵使得每条纵向切割线均与骨牌相交。骨牌可以旋转,即可以使用 $1\times 2$ 和 $2\times 1$ 的多米诺骨牌。 每一张骨牌都要上色,为了简化题目,一个小写字母即代表一种颜色,同一颜色的骨牌不能相邻。 请你输出一种满足要求的方案。 **输入格式** 输入一个整数 $n$($1\le n\le 100$),表示矩阵的列数。 **输出格式** 输出一个 $4\times n$ 的由小写字母组成的矩阵,第 $(i,j)$ 格的字符表示覆盖该位置的骨牌的颜色。 若没有满足要求的方案,请输出 `-1`。

题目描述

We all know the problem about the number of ways one can tile a $ 2×n $ field by $ 1×2 $ dominoes. You probably remember that it goes down to Fibonacci numbers. We will talk about some other problem below, there you also are going to deal with tiling a rectangular field with dominoes. You are given a $ 4×n $ rectangular field, that is the field that contains four lines and $ n $ columns. You have to find for it any tiling by $ 1×2 $ dominoes such that each of the $ n-1 $ potential vertical cuts along the grid lines intersects at least one domino, splitting it in two. No two dominoes in the sought tiling should overlap, each square of the field should be covered by exactly one domino. It is allowed to rotate the dominoes, that is, you can use $ 2×1 $ as well as $ 1×2 $ dominoes. Write a program that finds an arbitrary sought tiling.

输入输出格式

输入格式


The input contains one positive integer $ n $ ( $ 1<=n<=100 $ ) — the number of the field's columns.

输出格式


If there's no solution, print "-1" (without the quotes). Otherwise, print four lines containing $ n $ characters each — that's the description of tiling, where each vertical cut intersects at least one domino. You should print the tiling, having painted the field in no more than $ 26 $ colors. Each domino should be painted a color. Different dominoes can be painted the same color, but dominoes of the same color should not be side-neighbouring. To indicate colors you should use lowercase Latin letters. Print any of the acceptable ways of tiling.

输入输出样例

输入样例 #1

4

输出样例 #1

yyzz
bccd
bxxd
yyaa

Input

题意翻译

**题意简述** 你要用 $1\times 2$ 的多米诺骨牌铺满一个 $4\times n$ 的矩阵使得每条纵向切割线均与骨牌相交。骨牌可以旋转,即可以使用 $1\times 2$ 和 $2\times 1$ 的多米诺骨牌。 每一张骨牌都要上色,为了简化题目,一个小写字母即代表一种颜色,同一颜色的骨牌不能相邻。 请你输出一种满足要求的方案。 **输入格式** 输入一个整数 $n$($1\le n\le 100$),表示矩阵的列数。 **输出格式** 输出一个 $4\times n$ 的由小写字母组成的矩阵,第 $(i,j)$ 格的字符表示覆盖该位置的骨牌的颜色。 若没有满足要求的方案,请输出 `-1`。

加入题单

算法标签: