21327_Steps

2022-5-16 18:19| 发布者: Hocassian| 查看: 57| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505155940200-Problem List-采集的数据-后羿采集器.html

Pro.ID

21327

Title

Steps

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21327

AC

22

Submit

53

Ratio

41.51%

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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.

    输出

    Description

    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

    Input consists of a line containing n, the number of test cases.

    Output

    For each test case, a line follows with two integers: 0 ≤ xy < 231. For each test case, print a line giving the minimum number of steps to get from x to y.

    Sample Input

    3
    45 48
    45 49
    45 50

    Sample Output

    3
    3
    4

    Source

    样例输入

    3
    45 48
    45 49
    45 50

    样例输出

    3
    3
    4

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部