21606_LineDis

2022-5-16 18:19| 发布者: Hocassian| 查看: 32| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505682381300-Problem List-采集的数据-后羿采集器.html

Pro.ID

21606

Title

LineDist

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21606

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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
    0 0
    0 1
    1 0
    1 1
    2
    2 0
    0 2
    -1 0
    0 1
    3
    0 0 0
    0 0 1
    1 1 0
    1 1 1
    3
    0 0 0
    0 0 1
    0 1 0
    1 1 0
    0

    Sample Output

    1.00
    0.00
    1.41
    1.00

    Source

    样例输入

    2
    0 0
    0 1
    1 0
    1 1
    2
    2 0
    0 2
    -1 0
    0 1
    3
    0 0 0
    0 0 1
    1 1 0
    1 1 1
    3
    0 0 0
    0 0 1
    0 1 0
    1 1 0
    0

    样例输出

    1.00
    0.00
    1.41
    1.00

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部