Venmo 一人注两号倒钱有被抓么# Money - 海外理财
o*y
1 楼
consider the process of stepping from integer x to integer y along the
integer points of the straight line. The length of each step must be non-
negative and can be one bigger than, equal to, or 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 both the first and the last step must be 1.
INPUT:
the input begins with a line containing the number of test cases - n. Each
test case that follows consists of a line with two integers: 0 <= x <= y <=
2^31.
OUTPUT:
for each test case, print a line giving the minimal number of steps to get
from x to y.
Sample input:
3
45 48
45 49
45 50
Sample output:
3
3
4
很有趣的一道题:)
integer points of the straight line. The length of each step must be non-
negative and can be one bigger than, equal to, or 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 both the first and the last step must be 1.
INPUT:
the input begins with a line containing the number of test cases - n. Each
test case that follows consists of a line with two integers: 0 <= x <= y <=
2^31.
OUTPUT:
for each test case, print a line giving the minimal number of steps to get
from x to y.
Sample input:
3
45 48
45 49
45 50
Sample output:
3
3
4
很有趣的一道题:)