21979_Pie

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

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

Pro.ID

21979

Title

Pie

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 4000/2000 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述

    A lot of boys and girls come to our company to pie friends. After we get their information, we need give each of them an advice for help. We know everyone's height, and we believe that the less difference of a girl and a boy has, the better it is. We need to find as more matches as possible, but the total difference of the matches must be minimum.

    输入

    The input consists of multiple test cases. The first line of each test case contains two integers, n, m ( 0 < n, m ≤ 10000 ), which are the number of boys and the number of girls. The next line contains n float numbers, indicating the height of each boy. The last line of each test case contains m float numbers, indicating the height of each girl. You can assume that |n – m| ≤ 100 because we believe that there is no need to do with that if |n – m| > 100. All of the values of the height are between 1.5 and 2.0.

    The last case is followed by a single line containing two zeros, which means the end of the input.

    输出

    Description

    A lot of boys and girls come to our company to pie friends. After we get their information, we need give each of them an advice for help. We know everyone's height, and we believe that the less difference of a girl and a boy has, the better it is. We need to find as more matches as possible, but the total difference of the matches must be minimum.

    Input

    The input consists of multiple test cases. The first line of each test case contains two integers, n, m ( 0 < n, m ≤ 10000 ), which are the number of boys and the number of girls. The next line contains n float numbers, indicating the height of each boy. The last line of each test case contains m float numbers, indicating the height of each girl. You can assume that |n – m| ≤ 100 because we believe that there is no need to do with that if |n – m| > 100. All of the values of the height are between 1.5 and 2.0.

    The last case is followed by a single line containing two zeros, which means the end of the input.

    Output

    Output the minimum total difference of the height. Please take it with six fractional digits.

    Sample Input

    2 3
    1.5 2.0
    1.5 1.7 2.0
    0 0

    Sample Output

    0.000000

    Source

    样例输入

    2 3
    1.5 2.0
    1.5 1.7 2.0
    0 0

    样例输出

    0.000000

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部