아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Master Zhu and Video

시간 제한1초메모리 제한512 MB

요약
볼륨을 p에서 q로 옮기는 최소 시간을 구한다. 연속으로 내리기 명령을 쓰면 감소량이 두 배가 된다.
난이도

보통10점 중 6점

유형
수학, 그리디
정답자
아직 제출이 없습니다

문제

Master Zhu is watching a video. He wants to adjust the sound volume from pp dB to qq dB. Master Zhu is powerful enough to control the sound volume mentally. He needs one second to issue one order. So, each second, he may either issue an order "Up!", issue an order "Down!", or do nothing.

If he issues an order "Up!", the volume increases by 11 dB. An order "Down!" works in a more compilcated way: if on the previous second, there was an order "Down!" and the volume decreased by xx dB, it decreases by 2⋅x2 \cdot x dB, otherwise the volume decreases by 11 dB.

If after some order the volume becomes negative, the system will break, so Master Zhu must be careful.

Find the minimum time needed for Master Zhu to adjust the volume from pp dB to qq dB.

입력

The first line of input contains one integer TT, the number of test cases (1≤T≤3⋅1051 \le T \le 3 \cdot 10^5).

Each of the next TT lines contains two integers pp and qq (0≤p,q≤1090 \le p, q \le 10^9).

출력

For each test case, print a single line with a single integer: the minimum time in seconds Master Zhu needs to adjust the volume.

예제1

  1. 예제 1

    입력
    2
    1 5
    7 3
    
    예상 출력
    4
    4