![]() |
||||||||||
|
||||||||||
MultipleTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1284 Accepted Submission(s): 363 Problem Description Given a positive integer N, you’re to solve the following problem: Find a positive multiple of N, says M, that contains minimal number of different digits in base-K notation. If there’re several solutions, you should output the numerical smallest one. By saying numerical smallest one, we compar their numerical value, so 0xAhex < 11dec. You may assume that 1 <= N <= 104 and 2 <= K <= 10. Input There’re several (less than 50) test cases, one case per line. For each test case, there is a line with two integers separated by a single space, N and K. Please process until EOF (End Of File). Output For each test case, you should print a single integer one line, representing M in base-K notation,the answer. Sample Input
Sample Output
Source | ||||||||||
|