luogu#P3922. 中学数学题
中学数学题
Background
Cirno: I got it! The answer is , because Gensokyo has no teleporter!
Rumia: I really can’t with you... Fine, let’s do another middle school math problem.
Saying that, Rumia wrote down a sequence:
$1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , \cdots , 2048 , 4096 , 8192 , 16384 , \cdots$.
Problem Description
Rumia: The general term of this sequence is .
Now, find how many numbers among the first terms have the first digit (for example, ).
The input is “encrypted”. See [Input Format] for details.
Input Format
One line with two positive integers, and .
If , then the actual is .
If , then the actual is .
Output Format
A single integer , representing how many numbers have the first digit .
1 3
1
0 1
1
1 10
1
Hint
For of the testdata, .
For of the testdata, .
For another of the testdata, .
For of the testdata, .
Translated by ChatGPT 5