New-year tree
For decoration of the New-year tree Peter has in the order a garland from the N lamps and Ê of different paints for their painting. How many methods can he to do it, if he must no 2 identical colors be alongside?
Specifications
Input
The amount of lamps is N, the amount of different paints is Ê. (1 ≤ K, N ≤ 15).
Output
Amount of methods of painting. If Peter can not paint a garland after the described requirements, to show out -1.
Problem information
Time Limit: 1 secondsMemory Limit: 64 MB
Balls for the passed test: 5
Complexity: 67% 81/249
Example
Example input6 2 |
Example output2 |
| ← "Mirror prime" numbers | Problems | Paint2D-Crack → |
