Three points P10622


Statement
 

pdf   zip

Let d(p,q)d(p, q) denote the geometric distance between two points pp and qq on the plane. Given three points aa, bb and cc, please choose three points aa', bb' and cc' such that:

  • aa', bb' and cc' are on the same straight line;

  • the sum of distances d(a,a)+d(b,b)+d(c,c)d(a, a') + d(b, b') + d(c, c') is as small as possible.

Input

Input consists of several cases, each one with three different points aa, bb and cc. Every given point has two real coordinates with at most two digits after the decimal point, and with absolute value between 00 and 10610^6.

Output

For every case, print the minimum sum of distances with four digits after the decimal point. The input cases have no precision issues.

Public test cases
  • Input

    0 0   100 0   0 100
    -1.5 -0.5   0.5 0.5   2.5 1.5
    

    Output

    70.7107
    0.0000
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++ Python