当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2194:Help the vendor and get some M ^_^

题目描述
A doll vendor has just received a shipment of dolls from the factory. The vendor can only sell dolls in pairs, and have to ensure that in each pair one doll is K times as large as the other. What is the maximum number of pairs that the vendor can assemble? Each doll can only be sold one time. Now the vendor wants your help to solve this problem. Of course, he will give you 30% of the profit, so, what are you waiting for?
输入解释
There are multiple test cases.For each case the input contains two integers N (1<=50<=N) and K (1<=K<=25) in first line and N doll sizes (integers between 1 and 100000, inclusive) below, where N is the number of dolls. The doll sizes may separated by white spaces or newline.Input ends when N and K is 0.
输出解释
For each case, output the maximum number of pairss that the vendor can assemble in one line.
输入样例
5 2
1 2 1 2 4
0 0
输出样例
2

Hint: you can sell two pairs at most, {(1,2),(1,2)} or {(1,2),(2,4)}.
来自杭电HDUOJ的附加信息
Author scnu
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-2194

最后修改于 2020-10-25T22:51:21+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000/1000MS(Java/Others) 32768/32768K(Java/Others)