Happy Birthday Kazima
All submissions for this problem are available.
Its Kazima's 13th birthday on this 13th and his father is very excited. To make this occasion memorable for him, he decides to decorate the venue of his birthday party with unique numbers having a special property-: Sum of digits of each number is equal to the date of birth(only the date, not month or year!) of his lovely child.
The numbers are to be printed on posters of same size(one number on one poster). Size of the poster is the number of digits you want to write on the poster. On asking the decorator for this job, Kazima's father realized that he will have to pay the cost of decoration at the rate of maximum poster size length required. Now he is confused about how many digits he would at least need for making N numbers with this property as this would directly imply the poster sizes he would need. Can you help him realize answer for this problem ?
The first line of the input contains an integer T denoting the number of test cases.
T lines follow each containing an integer N, numbers kazima wants to generate
One Integer answer for every test case which is the minimum digits needed for generating N numbers
Sample Input Explanation
Numbers whose digits sum to 13 : 49,58,67,76,85,94,139,148,157,166...
for just 2 such numbers we can pick for example 49 and 67 which would require only 2 digits
for 7 numbers we will need 3 digits as only six 2 digit numbers have this property, one 3 digit number would be required
- 1 ≤ T ≤ 100
- 0 ≤ N ≤ 75000
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions