시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB60930025955.819%

문제

One steps through integer points of the straight line. The length of a step must be nonnegative and can be by one bigger than, equal to, or by one smaller than the length of the previous step.

What is the minimum number of steps in order to get from x to y? The length of the first and the last step must be 1.

입력

Input consists of a line containing n, the number of test cases. For each test case, a line follows with two integers: 0 <= x <= y < 2^31.

출력

For each test case, print a line giving the minimum number of steps to get from x to y.

예제 입력 1

3
45 48
45 49
45 50

예제 출력 1

3
3
4

출처

Contest > Waterloo's local Programming Contests > 29 January, 2000 E번

  • 문제의 오타를 찾은 사람: jh05013