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

建议使用的浏览器:

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

3807:How many people have ipad II

题目描述
hh found more and more of his friends are having ipad IIs. One day when they get together, hh asked his five friends, "How many of you have ipad II now?"

"One!"
"Three!"
"Everyone!"
"Four!"
"Two!"

hh's friends knew each other. They were clear about the "how many" question, while the answers are different, so there must be some people telling lies.

One of hh's friends told him(hh):
number of people, who had ipad IIs, and lied, was no more than 1.
number of people, who didn't have ipad IIs, and told the truth, was no more than 2.
at least one people have ipad II.

Given the information, hh realized there may be one or two people having ipad IIs.

Now hh asks N people the "how many" question. These N friends answer one by one. Some tell the truth, some lie. What hh knows is:
1.number of people, who have ipad IIs, and lie, is no more than A.
2.number of people, who don't have ipad IIs, and tell the truth, is no more than B.
3.At least one people have ipad II.

How many ipad IIs do these N people have?
输入解释
The input begins with an integer T(1<=T<=100).
The next T blocks each indicates a case.
The first line of each case contain a number N(1<=N<=16) then N positive integers follow, integers won't be lager than N.
Then following two numbers A , B(0 <= A,B <= N).
输出解释
Output the number of people have ipad II.
There may be many answers, output them by increasing order. (separated by space)
Output "impossible" if that's impossible.
输入样例
3
5
1 2 3 4 5
1 2

3
0 0 0
1 1

4
0 0 0 0
0 1
输出样例
1 2
1
impossible
来自杭电HDUOJ的附加信息
Author NotOnlySuccess
Recommend lcy

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

源链接: HDU-3807

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

共提交 0

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