Problem A
Unlock Pattern
A pattern is more complex if the total length of the stroke is longer. Given an unlock pattern, can you calculate its length? We assume that the pivots are aligned on a unit grid, and the stroke moves in a straight line between two consecutive pivots.
The sample input corresponds to the unlock pattern in the image.
Input
The input has three lines. Each line has three non-zero digits separated by a single space. The digits describe the order in which the pivots are visited. Every digit from $1$ to $9$ appears exactly once.
Output
Output the total length of the unlock pattern. Your answer is considered correct if it has an absolute or relative error of at most $10^{-6}$ from the correct answer.
Sample Input 1 | Sample Output 1 |
---|---|
6 1 9 5 2 8 4 3 7 |
9.8284271247 |