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

30756번 - Gleb and Two Numbers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB49403680.000%

문제

When Gleb is not busy with writing long problem statements he enjoys playing with numbers. He picks two integers $l$ and $r$ and tries to find integers $a$ and $b$ such that $l \le a \le b ≤ r$ and the Hamming distance between $a$ and $b$ is maximum possible.

The Hamming distance between two integers $x$ and $y$ is defined as the number of decimal places at which they are different. If these integers are of different length, the shorter one is prepended with leading zeroes.

입력

The first line of the input contains a single integer $l$ and the second line contains a single integer $r$ (1ドル \leq l \leq r \leq 10^{1,000円,000円}$).

출력

Print the maximum possible Hamming distance between a pair of integers in range from $l$ to $r$.

제한

예제 입력 1

11
17

예제 출력 1

1

예제 입력 2

1
11

예제 출력 2

2

노트

In the first sample, one can choose integers 12ドル$ and 16ドル$. In the second sample, 1ドル$ and 10ドル$ form an optimal answer.

출처

Olympiad > Moscow Open Olympiad in Informatics > Moscow Open Olympiad in Informatics 2016-17 > Day 1 Halva번

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

출처

대학교 대회

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

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