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

建议使用的浏览器:

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

3489:Knapsack I

题目描述

Lambert wants to carry several kinds of items with a knapsack. Items of each kind have integral size and infinite supply. The knapsack also has an integral capacity. Due to some esoteric reasons, an item of any kind can be divided evenly into a fixed number of identical parts. The resulting parts can again be divided, and the process of even division can go on endlessly. Given n kinds of items, can the capacity of the knapsack be fulfilled?

输入解释

The input contains multiple test cases. Each test case begins with a line containing three positive integers n, x and k (n ≤ 1000, k ≥ 2), where x is the capacity of the knapsack, and k means each division divides an item or a divided part into k identical smaller parts. Then comes a line containing n positive integers, the sizes of different kinds of items.

输出解释

For each test case, output one line containing “Yes” if the knapsack can be fulfilled or “No” otherwise.

输入样例
2 3 5
4 11
3 16 2
3 6 9
输出样例
Yes
No

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3489

最后修改于 2020-10-29T07:02:46+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 131072