编程介的小学生 2017-05-01 02:36 采纳率: 20.5%
浏览 990
已采纳

Knapsack I

Description

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?

Input

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.

Output

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

Sample Input

2 3 5
4 11
3 16 2
3 6 9
Sample Output

Yes
No

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用