Logo
(追記) (追記ここまで)

5940번 - Math Practice 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB57025821042.596%

문제

One lovely afternoon, Bessie's friend Heidi was helping Bessie review for her upcoming math exam.

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 B

Thus, E=6 is the proper answer.

NOTE: The value of 2^44 does not fit in a normal 32-bit integer.

입력

  • Line 1: Two space-separated integers: A and B

출력

  • Line 1: A single integer E calculated as above

제한

예제 입력 1

1 6

예제 출력 1

6

힌트

출처

Olympiad > USA Computing Olympiad > 2010-2011 Season > USACO November 2010 Contest > Bronze 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /