All problems

The Length of a Vector

easyPythonNumPynp.linalg.norm

Larkspur Labs flies a survey drone out from a fixed base. The flight log never records where the drone ended up. It records how far the drone travelled along each of the site's marked axes — so many metres north, so many east, and so on, one figure per axis. The recovery team does not care about the route the drone took to get there. It wants the distance from the base to the drone in a straight line, counting every axis at once, which is the number that decides whether a walker can reach it before dark.

Task: Print the drone's straight-line distance from base.

Input

Two lines. The first holds an integer n, the number of axes. The second holds n figures separated by single spaces, one per axis. A figure may be zero.

Output

One line holding the straight-line distance, written with exactly two decimal places. A drone that never left prints 0.00.

Example:

Input:
2
3 4

Output:
5.00

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…