#C7196. Road Trip Log

    ID: 51040 Type: Default 1000ms 256MiB

Road Trip Log

Road Trip Log

You are given a list of stops, each represented by its (x, y) coordinates. Your task is to calculate the Euclidean distances between each pair of consecutive stops and then compute the total distance traveled. The Euclidean distance between two points \((x_1, y_1)\) and \((x_2, y_2)\) is given by:

\(\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}\)

Round each individual distance and the total sum to exactly two decimal places.

inputFormat

The input is read from standard input (stdin) and has the following format:

  • The first line contains an integer \(N\) representing the number of stops.
  • The following \(N\) lines each contain two integers separated by a space, representing the coordinates \(x\) and \(y\) of a stop.

For example:

3
0 0
3 4
6 0

outputFormat

The output should be printed to standard output (stdout) in a single line. It consists of \(N\) numbers separated by a space. The first \(N-1\) numbers are the distances between consecutive stops, and the last number is the total distance traveled. All distances must be rounded to two decimal places.

For example, the output for the sample input would be:

5.00 5.00 10.00
## sample
3
0 0
3 4
6 0
5.00 5.00 10.00