No.1797 Eternal Grid
タグ : / 解いたユーザー数 43
作問者 :
Problem Statement
Takahashi wants to paint an infinitely extending grid so that the following conditions are satisfied.
- The grid is painted by repeating a pattern of an $H\times W$ grid
- Exactly $K$ colors are used
How many such ways of painting are there? Rotations and reflections are distinguished, but a pattern and the result of translating it to the right or downward any natural number of times are counted as $1$ way. Colors are distinguishable.
Example 1:緑緑青 と 緑青緑 と 青緑緑
are the same pattern. (They are moved to the right a natural number of times.)
A cell that leaves the range at the top, bottom, left, or right due to the movement moves to the opposite edge.
Example 2:赤青緑 赤緑赤 緑青青 と 青緑赤 赤赤緑 青青緑
are the same pattern. (It is translated 2 times to the right and 1 time downward.)
Input
$H\ W\ K$
- $1 \le H \times W \le 10$
- $1 \le K \le 3$
Output
Output the answer on $1$ line. Print a newline at the end.
Sample
Sample 1
Input
2 3 2
Output
12
■□□ ■■□ ■□□ ■□□ □□□ □□□ ■□□ □■□ ■■□ ■□■ ■■■ ■□■ ■□□ ■□□ □□□ □■□ □□■ □■■ □■■ □■■ ■■■ □■■ ■□■ ■■■
These are the 12 patterns.
Sample 2
Input
1 1 1
Output
1
Naturally, there is only 1 way.
Sample 3
Input
3 3 3
Output
2022
This year is 2022, isn't it. Happy New Year.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。