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

33000번 - The Sparsest Number in Between 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB93615664.368%

문제

You are given a pair of positive integers $a$ and $b$ ($a ≤ b$). Among those integers between $a$ and $b,ドル inclusive, your task is to find the sparsest one, that is, the one with the least number of 1’s in its binary representation. If there are two or more such integers, you should find the smallest among them.

Suppose, for instance, that $a = 10$ and $b = 13$. The integers between $a$ and $b,ドル inclusive, are 10ドル,ドル 11ドル,ドル 12ドル,ドル and 13ドル,ドル and their binary representations are 1010, 1011, 1100, and 1101, respectively. Thus, in this case, the answer is 10ドル,ドル since 10ドル$ and 12ドル$ have the least number of 1’s in their binary representations and 10ドル$ is smaller than 12ドル$.

입력

The input consists of a single test case of the following format.

$a$ $b$

Here, $a$ and $b$ ($a ≤ b$) are integers between 1ドル$ and 10ドル^{18},ドル inclusive.

출력

Output a line containing the smallest among the sparsest integers between $a$ and $b,ドル inclusive.

제한

예제 입력 1

10 13

예제 출력 1

10

예제 입력 2

11 15

예제 출력 2

12

예제 입력 3

11 20

예제 출력 3

16

예제 입력 4

1 1000000000000000000

예제 출력 4

1

예제 입력 5

9876543210 9876543210

예제 출력 5

9876543210

힌트

출처

ICPC > Regionals > Asia Pacific > Japan > 2024 ICPC Asia Yokohama Regional Contest B번

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

출처

대학교 대회

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

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