AtCoder Beginner Contest 146
翻译中…
Problem Statement
翻译中…
Takahashi has come to an integer shop to buy an integer.
翻译中…
The shop sells the integers from $1$ through $10^9$. The integer $N$ is sold for $A \times N + B \times d(N)$ yen (the currency of Japan), where $d(N)$ is the number of digits in the decimal notation of $N$.
翻译中…
Find the largest integer that Takahashi can buy when he has $X$ yen. If no integer can be bought, print $0$.
翻译中…
Constraints
翻译中…
- All values in input are integers.
$1 \leq A \leq 10^9$$1 \leq B \leq 10^9$$1 \leq X \leq 10^{18}$
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
A B X
翻译中…
Output
翻译中…
Print the greatest integer that Takahashi can buy. If no integer can be bought, print $0$.
翻译中…
样例
Input #1
10 7 100
Output #1
9
The integer $9$ is sold for $10 \times 9 + 7 \times 1 = 97$ yen, and this is the greatest integer that can be bought. Some of the other integers are sold for the following prices:
- $10: 10 \times 10 + 7 \times 2 = 114$ yen
- $100: 10 \times 100 + 7 \times 3 = 1021$ yen
- $12345: 10 \times 12345 + 7 \times 5 = 123485$ yen
Input #2
2 1 100000000000
Output #2
1000000000
He can buy the largest integer that is sold. Note that input may not fit into a $32$-bit integer type.
Input #3
1000000000 1000000000 100
Output #3
0
Input #4
1234 56789 314159265
Output #4
254309
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。