题目
Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the werewolves and the human beings. Suppose that in a game,
- player #1 said: "Player #2 is a werewolf.";
- player #2 said: "Player #3 is a human.";
- player #3 said: "Player #4 is a werewolf.";
- player #4 said: "Player #5 is a human."; and
- player #5 said: "Player #4 is a human.".
Given that there were 2 werewolves among them, at least one but not all the werewolves were lying, and there were exactly 2 liars. Can you point out the werewolves?
Now you are asked to solve a harder version of this problem: given that there were N players, with 2 werewolves among them, at least one but not all the werewolves were lying, and there were exactly 2 liars. You are supposed to point out the werewolves.
Input Specification:
Each input file contains one test case. For each case, th

该博客介绍了PAT甲级编程竞赛的一道题目——Werewolf,玩家分为狼人和人类,玩家间互相指认身份。题目要求在给定条件下找出狼人的身份,即2个狼人,至少1个狼人在说谎,总共有2个说谎者。博主提供了问题的输入输出规格、难点解析、伪代码和满分代码。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



