#Q229. 「一本通 6.6 例 2」2^k 进制数
「一本通 6.6 例 2」2^k 进制数
Description
Original source: NOIP 2006 Senior Division
Let be a -based number that satisfies the following conditions:
- must be at least a 2-digit number in base .
- As a -based number, every digit of (except the last one) is strictly less than the digit immediately to its right.
- After converting to a binary number , the total number of bits in does not exceed .
Here, the positive integers and are given in advance.
Question: How many distinct satisfy the above conditions?
Input Format
The input consists of a single line with two positive integers and .
Output Format
The output is a single line containing a positive integer, which is the result of the calculation—the number of distinct that satisfy the conditions (expressed in decimal, with the highest digit not being zero and no additional characters such as spaces, line breaks, or commas inserted between digits).
Note: The resulting positive integer may be very large but will not exceed 200 digits.
Sample 1
3 7
36
Data Range and Hint
For all data, .