|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||116||14||13||14.943%|
My birthday is coming up. Alas, I am getting old and would like to feel young again. Fortunately, I have come up with an excellent way of feeling younger: if I write my age as a number in an appropriately chosen base b, then it appears to be smaller. For instance, suppose my age in base 10 is 32. Written in base 16 it is only 20!
However, I cannot choose an arbitrary base when doing this. If my age written in base b contains digits other than 0 to 9, then it will be obvious that I am cheating, which defeats the purpose. In addition, if
my age written in base b is too small then it would again be obvious that I am cheating. Given my age y and a lower bound ℓ on how small I want my age to appear, find the largest base b such that y written in base b contains only decimal digits, and is at least ℓ when interpreted as a number in base 10.
The input consists of a single line containing two base 10 integers y (10 ≤ y ≤ 1018 – yes, I am very old) and ℓ (10 ≤ ℓ ≤ y).
Display the largest base b as described above.