Problem 1882 --Problem E - Steps

1882: Problem E - Steps

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $2$ 正确数量 $2$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签

Problem E - Steps

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.

3
45 48
45 49
45 50
3
3
4

推荐代码 查看1882 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$44 $ms] 淡意的温柔 588598 2020-05-29 15:14:59
内存最少[$1152 $KB] 淡意的温柔 588598 2020-05-29 15:14:59
第一AC AOJ大管家 84397 2017-04-27 15:28:02
第一挑战 AOJ大管家 84397 2017-04-27 15:28:02

赛题来源/所属竞赛 NA N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛