|VIRTUAL JUDGE||Recent Contest||F.A.Qs||Discuss||Home||ProblemSet||Status||Ranklist||4 Contest||Login||Register||Exam|
Consider the process of stepping from integer x to integer y along 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.
The input begins with a line containing n, the number of test cases. Each test case that follows consists of a line with two integers: 0<=x<=y <231.
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
Waterloo local 2000.01.29
한국어 中文 English
All Copyright Reserved 2008-2010 SDIBT TEAM
GPL2.0 2003-2010 HUSTOJ Project TEAM
Anything about the Problems, Please Contact Admin:admin