#K78997. Taco Game: Total Moves Computation
Taco Game: Total Moves Computation
Taco Game: Total Moves Computation
Mia and Noah are playing the Taco Game on a linear linked list with n nodes. Mia always starts at the first node (node 1), and Noah starts at node y (with 1 < y ≤ n). In this game, the total number of moves made is determined by the distance Noah is from the starting point. Specifically, the total moves are computed by the formula:
\(2\times(y-1)\)
This is because Mia needs to cover the distance from node 1 to node y and, in the process, the moves are effectively doubled. Your task is to implement a function that computes this number of moves when given n and y.
inputFormat
The input consists of a single line containing two space-separated integers:
- n — the total number of nodes in the linked list.
- y — the starting node of Noah (with the constraint 1 < y ≤ n).
Both values are provided via standard input.
outputFormat
Output a single integer representing the total number of moves calculated by the formula:
\(2\times(y-1)\)
The result should be printed to standard output.
## sample6 4
6