|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||18||1||1||50.000%|
Given three values n, a, and b, find the smallest m>n such that the sum of the digits of m in base a is the same as the sum of digits of m in base b.
Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. There will be a single line of input, with three integers, n (0 ≤ n ≤ 1016), a and b (2 ≤ a < b ≤ 36), all of which will be in base 10.
Output a single integer, m, which is the smallest number greater than n such that the sum of its digits in base a is the same as the sum of its digits in base b. Output m in base 10.
66 10 16
24 4 15
9358385 11 32