{ 二分答案 }soj2015

来源:互联网 发布:关闭多台linux系统脚本 编辑:程序博客网 时间:2024/04/30 18:55

2015. A New Year Gift
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 M are 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
 Copy sample input to clipboard
53 3 3 3 3561 2 3 4 5 650
Sample Output
33

我是要WA多几题才有二分答案的概念。。。。。。。

不是dp能证明贪心都给我去二分啊啊啊啊

原创粉丝点击