Fişierul intrare/ieşire: | cntnk.in, cntnk.out | Sursă | IIOT 2021-22 Runda 2 |
Autor | Bogdan Ioan Popa, Daniel Popa | Adăugată de | |
Timp execuţie pe test | 0.25 sec | Limită de memorie | 65536 kbytes |
Scorul tău | N/A | Dificultate | N/A |
Vezi solutiile trimise | Statistici
Cntnk
Bemfa has a new drawing board, which is split into N rows, each row contains N cells. He has K different colors and now he is wondering in how many ways can he color the given board in such a way that each cell is colored with exactly one color and no two neighboring cells have the same color.
Two cells are considered to be neighbors if they share one side.
Help Bemfa count how many ways mod 10^9 + 7 are there to color the board given the above mentioned constraints.
Date de intrare
The first line of the input file cntnk.in contains two integers, N and K.
Date de ieşire
The output file cntnk.out will contain a single integer, representing the answer to the given test case.
Restricţii
- 1 ≤ N ≤ 8
- 2 ≤ K ≤ 5
Exemplu
cntnk.in | cntnk.out |
---|---|
3 4 | 9612 |