Yet Another Two Integers Problem SOLUTION
You are given two whole numbers an and b. In one move, you can pick some whole number k from 1 to 10 and add it to an or deduct it from a. As such, you pick a whole number k∈[1;10] and perform a:=a+k or a:=a−k. You may utilize various estimations of k in various moves.
Your undertaking is to locate the base number of moves needed to acquire b from a.
You need to answer t free experiments.
Info
The main line of the info contains one number t (1≤t≤2⋅104) — the quantity of experiments. At that point t experiments follow.
The main line of the experiment contains two whole numbers an and b (1≤a,b≤109).
Yield
For each experiment, print the appropriate response: the base number of moves needed to get b from a.
Model
inputCopy
6
5
13 42
18 4
1337 420
123456789 1000000000
100500 9000
outputCopy
0
3
2
92
87654322
9150
Note
In the primary experiment of the model, you don’t have to do anything.
In the subsequent experiment of the model, the accompanying arrangement of moves can be applied: 13→23→32→42 (include 10, include 9, include 10).
In the third experiment of the model, the accompanying succession of moves can be applied: 18→10→4 (take away 8, deduct 6).