编程介的小学生 2017-07-14 11:40 采纳率: 20.5%
浏览 958
已采纳

How many people have ipad II

Problem Description
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?

Input
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
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.

Sample Input
3
5
1 2 3 4 5
1 2

3
0 0 0
1 1

4
0 0 0 0
0 1

Sample Output
1 2
1
impossible

  • 写回答

1条回答 默认 最新

  • devmiao 2017-07-29 13:55
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改