Save Labman No.004
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1243 Accepted Submission(s): 415
Problem Description Due to the preeminent research conducted by Dr. Kyouma, human beings have a breakthrough in the understanding of time and universe. According to the research, the universe in common sense is not the only one. Multi World Line is running simultaneously. In simplicity, let us use a straight line in three-dimensional coordinate system to indicate a single World Line.
During the research in World Line Alpha, the assistant of Dr. Kyouma, also the Labman No.004, Christina dies. Dr. Kyouma wants to save his assistant. Thus, he has to build a Time Tunnel to jump from World Line Alpha to World Line Beta in which Christina can be saved. More specifically, a Time Tunnel is a line connecting World Line Alpha and World Line Beta. In order to minimizing the risks, Dr. Kyouma wants you, Labman No.003 to build a Time Tunnel with shortest length.
Input The first line contains an integer T, indicating the number of test cases.
Each case contains only one line with 12 float numbers (x1, y1, z1), (x2, y2, z2), (x3, y3, z3), (x4, y4, z4), correspondingly indicating two points in World Line Alpha and World Line Beta. Note that a World Line is a three-dimensional line with infinite length.
Data satisfy T <= 10000, |x, y, z| <= 10,000.
Output For each test case, please print two lines.
The first line contains one float number, indicating the length of best Time Tunnel.
The second line contains 6 float numbers (xa, ya, za), (xb, yb, zb), seperated by blank, correspondingly indicating the endpoints of the best Time Tunnel in World Line Alpha and World Line Beta.
All the output float number should be round to 6 digits after decimal point. Test cases guarantee the uniqueness of the best Time Tunnel.
Sample Input
1
1 0 1 0 1 1 0 0 0 1 1 1
Sample Output
0.408248
0.500000 0.500000 1.000000 0.666667 0.666667 0.666667
Source 2013 ACM/ICPC Asia Regional Hangzhou Online
Recommend liuyiding 好吧,看了线代也不会解方程的说。。。于是还是去看了看大神的博客。。。。