DRACULA - Dracula
In Transylvania, 1753, Dracula has returned from his long sleep, now, of course, all the citizens of Transylvania want to escape from the city. The only way out of the island is famous boat Hellman, and Petr is the ticket seller.
All tickets available are numbered from A to B, inclusive, with 0 < A, B < 1018.
The cost of a ticket is the sum of the digits of it's numbers in gold coins, so, for an example the ticket 14 costs coins 5 (1+4).
Van Helsing has X gold coins, but he does not know which tickets to buy, or how many tickets he can buy at most. Since you are the mathematician of the city, you were charged with solving this problem.
The input contains an integer T, number of test cases. Each test case contains three integers 0 < A, B, X < 1018 as described in the statement.
For each test case print one line containing an integer, the number of tickets to Van Helsing
can buy at most.
2 5 5 Output: 2
nice problem :D
Last edit: 2015-11-25 01:14:11
Fantastic problem, except for one thing... the input values are <= 10^18, not < 10^18 ! :(
And finally I've done this! Yeah!Last edit: 2013-02-26 09:06:25
Diogo Soares [UFAM]:
Anyone has a critical test case?
more sample test cases please..
Yup, strange unround numbers like 106 always suggest a missing "^"
its 10^18 i guess
[Retired] Fendy Kosnatha:
what is the right for A and B??