22135_ANewYearGif

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

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

Pro.ID

22135

Title

A New Year Gift

Title链接

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

AC

26

Submit

112

Ratio

23.21%

时间&空间限制

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

    Windbreaker was planning to send his friends some necklaces as New Year gifts. To show sincerity, he decided to make the necklaces all by himself. He bought some kinds of pearls and each kind of pearls has a different color from others. He wanted to make each necklace consisted of M pearls from different kinds, that's what he called M-perfect necklace. Windbreaker wanted to know the maximum number of necklaces he could send out to his friends. The number of pearls of each kind and Mare given, and now you are asked to tell Windbreaker how many M-perfect necklaces he could make at most.

    输入

    You will be given a number of cases in the input. Each case starts with a positive integer n ( n ≤ 1000 ), which is the number of different kinds;

    The second line contains n positive numbers represent for the number of pearls of each kind which will not exceed 2000.

    The third line contains a positive number M ( 1 ≤ M ≤ 100 ).

    The end of input is indicated by a line containing n=0.

    输出

    Description

    Windbreaker was planning to send his friends some necklaces as New Year gifts. To show sincerity, he decided to make the necklaces all by himself. He bought some kinds of pearls and each kind of pearls has a different color from others. He wanted to make each necklace consisted of M pearls from different kinds, that's what he called M-perfect necklace. Windbreaker wanted to know the maximum number of necklaces he could send out to his friends. The number of pearls of each kind and Mare given, and now you are asked to tell Windbreaker how many M-perfect necklaces he could make at most.

    Input

    You will be given a number of cases in the input. Each case starts with a positive integer n ( n ≤ 1000 ), which is the number of different kinds;

    The second line contains n positive numbers represent for the number of pearls of each kind which will not exceed 2000.

    The third line contains a positive number M ( 1 ≤ M ≤ 100 ).

    The end of input is indicated by a line containing n=0.

    Output

    For each test case, output a line containing the Maximum number of M-perfect necklaces.

    Sample Input

    5
    3 3 3 3 3
    5
    6
    1 2 3 4 5 6
    5
    0

    Sample Output

    3
    3

    Source

    样例输入

    5
    3 3 3 3 3
    5
    6
    1 2 3 4 5 6
    5
    0

    样例输出

    3
    3

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部