22382_Min

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

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

Pro.ID

22382

Title

Mint

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 800/400 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    The Royal Canadian Mint has commissioned a new series of designer coffee tables, with legs that are constructed from stacks of coins. Each table has four legs, each of which uses a different type of coin. For example, one leg might be a stack of quarters, another nickels, another loonies, and another twonies. Each leg must be exactly the same length.

    Many coins are available for these tables, including foreign and special commemorative coins. Given an inventory of available coins and a desired table height, compute the lengths nearest to the desired height for which four legs of equal length may be constructed using a different coin for each leg.

    输入

    Input consists of several test cases. Each case begins with two integers: 4 ≤ n ≤ 50 giving the number of types of coins available, and 1 ≤ t ≤ 10 giving the number of tables to be designed. n lines follow; each gives the thickness of a coin in hundredths of millimetres. t lines follow; each gives the height of a table to be designed (also in hundredths of millimetres). A line containing 0 0 follows the last test case.

    输出

    Description

    The Royal Canadian Mint has commissioned a new series of designer coffee tables, with legs that are constructed from stacks of coins. Each table has four legs, each of which uses a different type of coin. For example, one leg might be a stack of quarters, another nickels, another loonies, and another twonies. Each leg must be exactly the same length.

    Many coins are available for these tables, including foreign and special commemorative coins. Given an inventory of available coins and a desired table height, compute the lengths nearest to the desired height for which four legs of equal length may be constructed using a different coin for each leg.

    Input

    Input consists of several test cases. Each case begins with two integers: 4 ≤ n ≤ 50 giving the number of types of coins available, and 1 ≤ t ≤ 10 giving the number of tables to be designed. n lines follow; each gives the thickness of a coin in hundredths of millimetres. t lines follow; each gives the height of a table to be designed (also in hundredths of millimetres). A line containing 0 0 follows the last test case.

    Output

    For each table, output a line with two integers: the greatest leg length not exceeding the desired length, and the smallest leg length not less than the desired length.

    Sample Input
    4 2
    50
    100
    200
    400
    1000
    2000
    0 0
    Sample Output

    800 1200
    2000 2000

    Source

    样例输入

    4 2
    50
    100
    200
    400
    1000
    2000
    0 0

    样例输出

    800 1200
    2000 2000

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部