#C10916. Minimum Total Distance
Minimum Total Distance
Minimum Total Distance
You are given several trips. In each trip, there are n cities represented by their populations. Your task is to determine the minimum total distance traveled to visit every city, starting from the first city. The distance is simply defined as moving from one city to the next in the order they appear.
Since you must visit every city exactly once and the cities are arranged in a linear order, the minimum total distance for visiting all cities is given by:
\(d = n - 1\)
where \(n\) is the number of cities in a trip.
Note: The populations provided for each city are not used in determining the distance.
inputFormat
The input is read from standard input (stdin) in the following format:
T n_1 p_{1,1} p_{1,2} ... p_{1,n_1} n_2 p_{2,1} p_{2,2} ... p_{2,n_2} ... n_T p_{T,1} p_{T,2} ... p_{T,n_T}
Here, the first line contains an integer T, the number of trips. For each trip, the first line contains a single integer n (number of cities), followed by a line containing n integers representing the populations of these cities (which can be ignored for the purpose of calculating the distance).
outputFormat
For each trip, output a single integer on a new line representing the minimum total distance required to visit all the cities. The answer for each trip is computed as n - 1.
## sample3
4
4 2 7 3
3
1 5 9
2
3 6
3
2
1
</p>