HUST Monthly 2010.06.13

From: 2010-06-13 12:00:00 To: 2010-06-13 17:00:00 Now: 2017-09-20 01:05:50 Status: Public

E - Projection

Time Limit: 1s Memory Limit: 128MB

Submissions: 7 Solved: 3
Description
Give two segments AB and CD in 3D space, if I choose a plane arbitrarily, what is the probability that the projection of the above two segments on that plane intersects?
Input
The input contains multiple cases each containing only one line. XA YA ZA XB YB ZB XC YC ZC XD YD ZD ——the coordinates of end points. All values are integers in [-100, 100]. It is guaranteed that AB and CD have no common points.
Output
For each case output the probability mentioned, accurate to five digits after the dot.
Sample Input
0 -100 0 0 100 0 -100 0 1 100 0 1
0 -1 0 0 1 0 -1 0 1 1 0 1
0 -10 0 0 10 0 -10 0 100 10 0 100
Sample Output
0.99100
0.33333
0.00630
Hint
Don’t output -0.00000.
Source
Hust Monthly 10.06.13/Han XU