#C9550. Taco Transformation Instructions
Taco Transformation Instructions
Taco Transformation Instructions
Given two integers startID and targetID, your task is to compute the minimum number of instructions needed to transform startID into targetID. In each move, you are allowed to either increment (+1) or decrement (-1) the current value. Mathematically, the minimum number of instructions is given by the formula: \( |targetID - startID| \).
The input consists of multiple test cases. For each test case, you need to output the computed number of instructions on a new line.
inputFormat
The first line of the input contains a single integer \( T \) representing the number of test cases. Each of the next \( T \) lines contains two space-separated integers: startID
and targetID
.
outputFormat
For each test case, output a single line containing the minimum number of instructions required to convert startID
to targetID
.
3
3 10
5 5
-1 1
7
0
2
</p>