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

19729번 - Valya and Letter 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB209584624.599%

문제

Valya got bored with social media, so she decided to write a good old handwritten letter to her friend. Valya wrote the letter on a rectangular sheet of paper. The sheet's dimensions are equal to $n$ and $m$ cm. Then she found a rectangular envelope with dimensions equal to $h$ and $w$ cm.

Unfortunately the letter could be too big to be placed into the envelope. So she might need to fold it several times. In one move Valya can fold the letter in half vertically or horizontally.

After folding the letter if necessary, Valya would put it into the envelope. Valya is a perfectionist, so she would always put the letter into the envelope in such way that its sides are parallel to the envelope's sides. The letter can be placed into the envelope if its corresponding dimensions don't exceed the envelope's dimensions. Before placing the letter Valya can rotate it by 90ドル$ degrees. For example, if the letter's dimensions are equal to 10ドル$ and 20ドル$ cm, and the envelope's dimensions are equal to 20ドル$ and 10ドル$ cm, Valya doesn't need to fold the letter, she can rotate it by 90ドル$ degrees to fit it into the envelope.

Valya doesn't want the letter to be crumpled so she wants to fold it the minimal possible number of times. Help her find this number.

입력

The first line of the input contains four integers $n,ドル $m,ドル $h$ and $w$ denoting the dimensions of the letter and dimensions of the envelope, respectively (1ドル \leq n, m, h, w \leq 10^{18}$).

출력

Output one number --- the minimal number of folds required, so that Valya could put the letter into the envelope.

제한

예제 입력 1

10 20 20 10

예제 출력 1

0

예제 입력 2

3 3 2 2

예제 출력 2

2

힌트

출처

Olympiad > Russian Olympiad in Informatics > Russia High School Programming Contest > Russia High School Programming Contest 2018 A번

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

출처

대학교 대회

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

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