#C11323. Minimum Moves
Minimum Moves
Minimum Moves
You are given a starting score \(Z\) and a target score \(Y\), along with a fixed integer \(X\). In one move, you can either add or subtract \(X\) from your current score. Your task is to determine the minimum number of moves required to reach exactly \(Y\) starting from \(Z\).
The answer for each test case is given by:
\(moves = \left\lceil \frac{|Y - Z|}{X} \right\rceil\)
where \(|Y - Z|\) is the absolute difference between \(Y\) and \(Z\) and \(\lceil \cdot \rceil\) denotes the ceiling function.
inputFormat
The first line of input contains an integer \(T\) representing the number of test cases. Each of the next \(T\) lines contains three space-separated integers \(X\), \(Y\), and \(Z\), where:
- \(X\) is the fixed integer that can be added or subtracted.
- \(Y\) is the target score.
- \(Z\) is the starting score.
All input is provided via standard input (stdin).
outputFormat
For each test case, output a single line containing the minimum number of moves required to reach exactly \(Y\) starting from \(Z\) by adding or subtracting \(X\). The results should be printed to standard output (stdout), with each answer on a new line.
## sample3
3 10 1
5 -3 1
2 8 1
3
1
4
</p>