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

建议使用的浏览器:

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

3748:Equivalent mass

题目描述
Little Min’s family has a grocery store,and she helps her parents to weight the goods everyday. She often wants to know whether the quality of the goods they sell can be equal to the sum quality of several poise weights. Suppose there are N kinds of poise weights, but there are M pairs of them can’t be used at the same time, and we know the quality of the goods is V. The question is: can little Min exactly take K form N poise weights, and their sum quality is equal to the goods’ quality?

输入解释
The first line contains an integer T, the number of test cases (T < 25). Each test case is in the following format.The first line starts with four integers N (1 <= N <= 32) denoting the number ofpoise weights and M (0 <= M <= 6),K(1<=K<=N),V(1<=V<=1000000000). The second line has N integer ai each denoting the kind poise weight's quality(1<=i<=N,1<=ai<=1000000000).Then following M lines, each line has two integers a and b, which denoting the a-th poise weight can't be used with the b-th poise weight at the same time(1<=a,b<=N,a!=b).
输出解释
For each test case, print one line containing YES if there exist exactly K poise weights' sum quality is equal to the good's quality, or output NO.
输入样例
2
5 1 3 1000
100 200 300 500 600
2 3
5 2 3 1000
100 200 300 500 600
2 3
1 5
输出样例
YES
NO
来自杭电HDUOJ的附加信息
Author erriyue
Recommend lcy

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

源链接: HDU-3748

最后修改于 2020-10-25T23:06:38+00:00 由爬虫自动更新

共提交 0

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