Candy Love (Contest)
Candy Love (Contest) easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Candy Love (Contest) easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
A shop sells candies of sweetness ranging from 1 to 1000000000. Price of a candy with sweetness X is AX + Bf(X) units, where f(X) returns number of digits in the decimal notation of X. Given A, B, and T, find the candy with maximum sweetness that Andy can buy if he has T units of money. If he cannot buy any candy, print 0. Input The first and the only line of input contains three integers A, B and T.
Constraints: 1 <= A, B <= 10^9 1 <= T <= 10^18 Output Print the maximum sweetness that Andy can buy if he has T units of money. If he cannot buy any candy, print 0. Example Sample Input 1 10 7 100
Sample Output 1 9
Explanation: Cost of 9 level candy = 910 + 7f(9) = 910 + 71 = 97.
Sample Input 2 1000000000 1000000000 100
Sample Output 2 0
link: