Fişierul intrare/ieşire:cntnk.in, cntnk.outSursăIIOT 2021-22 Runda 2
AutorBogdan Ioan Popa, Daniel PopaAdăugată destefdascalescuStefan Dascalescu stefdascalescu
Timp execuţie pe test0.25 secLimită de memorie65536 kbytes
Scorul tăuN/ADificultateN/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.incntnk.out
3 4
9612
Trebuie sa te autentifici pentru a trimite solutii. Click aici

Cum se trimit solutii?