Pro.ID21606 TitleLineDist Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21606 AC0 Submit0 Ratio- 时间&空间限制描述In n-dimension space, a line can be determined by two distinct points. Your task is to calculate the distance between the two lines. Distance between two lines is defined as the minimal distance of two points in the two lines respectively. Distance of two points A( x1, x2, ..., xn ) and B( y1, y2, ..., yn ) is defined as sqrt( (x1-y1)2 + (x2-y2)2 + ... + (xn-yn)2 ) . 输入There are several test cases. For each case, there are five lines, the first line contains the integer number n, and then each of the next four lines contains n integer numbers, these data are for four points A, B, C and D. A and B are distinct and determines line AB, C and D are distinct and determines line CD, you should calculate distance between AB and CD. Constraints: 2 ≤ n ≤ 3, other input numbers will be between -1000 and 1000. Input is ended with n = 0. 输出Description In n-dimension space, a line can be determined by two distinct points. Your task is to calculate the distance between the two lines. Distance between two lines is defined as the minimal distance of two points in the two lines respectively. Distance of two points A( x1, x2, ..., xn ) and B( y1, y2, ..., yn ) is defined as sqrt( (x1-y1)2 + (x2-y2)2 + ... + (xn-yn)2 ) . Input There are several test cases. For each case, there are five lines, the first line contains the integer number n, and then each of the next four lines contains n integer numbers, these data are for four points A, B, C and D. A and B are distinct and determines line AB, C and D are distinct and determines line CD, you should calculate distance between AB and CD. Constraints: 2 ≤ n ≤ 3, other input numbers will be between -1000 and 1000. Input is ended with n = 0. Output Output each result in a single line, with two digit precision after the decimal point. Sample Input 2 Sample Output 1.00 Source 样例输入2 样例输出1.00 作者 |