Inaho IV

View as PDF

Points: 7 (partial)
Time limit: 0.6s
Memory limit: 64M

Authors:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Inaho has just realized he can travel diagonally, and also that density has nothing to do with how fast he can travel. He very much appreciates your help for trying to walk him through space, but he no longer needs your instructions. He now only needs the direct distance from his current position to his destination. As he still cannot understand the complexities of -dimensions, please help him (for the last time, we promise)!

Given his current position and his destination point, find the direct distance if he is able to travel diagonally.

Input Specification

The first line will contain the integer , the number of dimensions.

The second line will contain decimal values which are the coordinates of his current position.

The third line will contain decimal values which are his destination coordinates.

For 1 of the 7 available marks, .

For an additional 1 of the 7 available marks, .

Output Specification

Output the direct distance from to .

Outputs with a relative or absolute error of will be accepted.

Sample Input 1

2
1.0 1.0
2.0 2.0

Sample Output 1

1.414213

Sample Input 2

3
1.5 2.5 4.0
0.2 5.0 0.0

Sample Output 2

4.892851