Not that DigitProblem code: NSIT15 |
Majin wants to label his N (1 <= N <= 1,000,000) towers. He has lost the labels with the digit L (0 <= L <= 9) written on them. Assume he has sufficient labels to complete the task.
If the towers are labeled with the smallest set of N positive integers that don't have the digit L, what is the largest number that Majin will label the tower as ?
Input
The first line has an integer 't' (1<=t<=10), the number of test cases. t cases follow.
Each test case containse two space-separated integers on a single line: N and L
Output
A single integer that is the largest number a tower can have.
Example
Input: 1 10 0 Output: 11 Explanation The smallest 10 numbers he can use are: 1, 2, 3, 4, 5, 6, 7, 8, 9, and 11.
| Author: | admin |
| Date Added: | 8-10-2009 |
| Time Limit: | 3 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

Life is so funny... and so is
Life is so funny... and so is codechef....
I was just not putting "n" after output...and was getting wrong answer from 5 hours!!!!
lol....
where to submit sol.
where to submit sol.