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

32791번 - Exact Change 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB69413065.217%

문제

While in Binaria, you find a store where you want to buy some presents for your friends. In Binaria, the currency is bits, and the coin denominations are the set of all integer powers of 2ドル$. You know that you want to spend at least $a$ bits here, but no more than $b$ bits.

When you make a purchase, you must pay with exact change. You have an unlimited number of bits that you can access from your bank account, but you can choose to withdraw them in whatever denominations you find most convenient. Carrying many coins is inconvenient though, so you wish to minimize the number of coins you carry with you.

Compute the minimum number of coins you need to bring with you such that you can pay any integer amount of bits between $a$ and $b,ドル inclusive.

입력

The first line of input contains a single integer $a,ドル 1ドル \le a < 2^{1000000}$. $a$ will be written in base 2 with no leading zeros.

The second line of input contains a single integer $b,ドル $a \le b < 2^{1000000}$. $b$ will be written in base 2 with no leading zeros.

출력

Output a single integer $k,ドル the minimum number of coins you need to bring.

제한

예제 입력 1

10101
101010

예제 출력 1

6

예제 입력 2

100
101

예제 출력 2

2

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2024 ICPC Pacific Northwest Regional > Division 1 E번

ICPC > Regionals > North America > Pacific Northwest Regional > 2024 ICPC Pacific Northwest Regional > Division 2 I번

  • 문제를 만든 사람: Nick Wu
(追記) (追記ここまで)

출처

대학교 대회

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

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