/* Obviously, if A and B are on the same side of a straight line, min (PA + Pb) = DIS (a, B); otherwise, obtain B's symmetric point on the straight line B ', min (PA + Pb) = DIS (A, B ') */# include <iostream> # include <cmath> # include <cstdio> using namespace STD; int main () {int C; Double K, X1, Y1, X2, Y2, X3, Y3, X, Y, DIS, t, a, B; CIN> C; while (c --) {CIN> K> x1> Y1> X2> Y2> X3> Y3; If (X3! = 1.0) t = k-k * X3 + Y3; // use the straight line (1, t) and (X3, Y3) this line l else t = 2 * k-k * X3 + Y3; // use a straight line (2, T) and (X3, Y3) represents this line l a = (1-x3) * (y2-y3)-(t-y3) * (x2-x3); B = (1-x3) * (y1-y3)-(t-y3) * (x1-x3 ); if (A * B> 0) // A, B is the cross product of AC, BC, and L, the difference is in the line of the opposite side {Y = (2 * Y3 + (K * K-1) * y2 + 2 * K * (x2-x3)/(K * k + 1 ); // The slope of the straight line where the simultaneous vectors (Ca + CB) are located is K and the slope of the straight line where the vector AB is located is-1/K. The two equations obtain B 'x = x2-k * (y-y2 ); dis = SQRT (x1-x) * (x1-x) + (y1-y) * (y1-y);} else Dis = SQRT (x1-x2) * (x1-x2) + (y1-y2) * (y1-y2); printf ("%. 2lf \ n ", DIS);} return 0 ;}