<PREV Problem:
NEXT>
Solved by 209 users: ...
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 

Lucky tickets

Time limit = 3

Find the number of lucky tickets with 2n digits in a number system with base q. A ticket is lucky if its number has 2n digits, with sums of the first n and the last n being equal.

Input consists of two numbers n and q, with 1 ≤ n ≤ 200 and 2 ≤ q ≤ 16.

Output the number of lucky tickets.

PS:
Lando. Happy tickets

Input#1
3 10
Output#1
55252

Author:
Classic problem.

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 200ms

SW soft NIX
ID = 54.81.197.127