<PREV Problem:
NEXT>
Solved by 209 users: ...
UserDateAttemptTimeCMSC
murphy13 sep 2006C++600.204466 
kia24 jun 2006C++100.28677 
ntoskrnl.dll02 apr 2010Java900.30415 
ntoskrnl.dll02 apr 2010Java1100.31400 
Jelly07 apr 2004FPC100.341109 
vova9413 dec 2012Java600.35377 
s01A0614 may 2011C100.352715 
regal28 aug 2009C++1600.39904 
a5b07 jan 2005C100.391998 
vi00228 may 2007Ruby1200.41188 
RAVEman17 mar 2009C++600.41591 
Languages
C++
74
Java
56
FPC
34
Kylix
17
Ruby
16
Python
11
C
8
Scheme
1
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

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 = 3.233.215.196