問題一覧 > 通常問題

No.1797 Eternal Grid

レベル : / AI推定難易度 : 1100 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 43
作問者 : ramdos / テスター : maple_1016
お気に入りにしたユーザー ProblemId : 7408 / 自分の提出
問題文最終更新日: 2022-01-05 04:56:06
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original

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もしくは右上の雲マークをクリックしてアカウントを作成してください。