Masala C
Degrees
Find the number of integers lying on the interval [A,B] that can be represented as the sum of exactly Y distinct powers of an integer X, where both X and the powers are integers.
For example, for A=15, B=20, Y=2, and X=2, the answer is 3 because:
The first line contains two integers A and B . The next two lines contain integers and
Print a single integer - the answer to the problem.
# | input.txt | output.txt |
---|---|---|
1 |
15 20 2 2 |
3 |