#P3922. 中学数学题

中学数学题

Description

Rumia: The general term of this sequence is xn=2n1 x_n = 2^{n-1} .

Now, find how many numbers among the first k+1 k+1 terms have the first digit 44 (for example, 40964096).

The input is “encrypted”. See [Input Format] for details.

Input Format

One line with two positive integers, t t and k0 k_0 .

If t=1 t = 1 , then the actual k k is k0 k_0 .

If t=0 t = 0 , then the actual k k is 10k0 10^{k_0} .

Output Format

A single integer ans ans , representing how many numbers have the first digit 44.

1 3

1

0 1

1

1 10

1

Hint

For 30% 30\% of the testdata, k0107, t=1 k_0 \leq 10^7, \ t = 1 .

For 70% 70\% of the testdata, k0109, t=1 k_0 \leq 10^9, \ t = 1 .

For another 30% 30\% of the testdata, k0233, t=0 k_0 \leq 233, \ t = 0 .

For 100% 100\% of the testdata, k01 k_0 \geq 1 .

Translated by ChatGPT 5