[문제요약] 두 수 A (0 <= A <= 45) , B( 1 <= B <= 9) 가 주어진다. A 보다 크고 2^E 의 첫 수가 B 와 같아지는 최소 정수 E ( 1..62) 를 출력하는게 문제이다.
Heidi presents two integers A (0 <= A <= 45) and B (1 <= B <= 9) to Bessie who must respond with an integer E in the range 1..62. E is the smallest integer in that range that is strictly greater than A and also has B as the first digit of 2 raised to the E-th power. If there is no answer, Bessie responds with 0.
Help Bessie correctly answer all of Heidi's questions by calculating her responses.
By way of example, consider A=1 and B=6. Bessie might generate a table like this:
E 2^E First digit of 2^E 2 4 4 3 8 8 4 16 1 5 32 3 6 64 6 <-- matches BThus, E=6 is the proper answer.
NOTE: The value of 2^44 does not fit in a normal 32-bit integer.
입력 1 6 출력 6
출처:usaco 2010 NOV bronze