PAT 甲级 1148 Werewolf - Simple Version 20分 PAT 甲级 1148 Werewolf - Simple Version 20分 题目 解析 代码 题目 题目描述 解析 由题意可知:说谎的两个人一个是狼,一个是村民。 所以可以枚举两只狼的位置,剩下的位置全是村民。 如果狼说某个人是狼但他却是村民或者说某个人是村民但他却是狼,那么说谎...
PAT 甲级 1148 Werewolf - Simple Version 20分 题目 解析 代码 题目 题目描述 解析 由题意可知:说谎的两个人一个是狼,一个是村民。 所以可以枚举两只狼的位置,剩下的位置全是村民。 如果狼说某个人是狼但他却是村民或者说某个人是村民但他却是狼,那么说谎的狼的数量就要+1;如果村民说某个人是狼但他却是...
题目链接:1148 Werewolf - Simple Version (20 point(s)) Description 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 #...
pta 1148 Werewolf - Simple Version 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...
参考@日沉云起【pat甲级1148 Werewolf - Simple Version、pat乙级1089 狼人杀-简单版题解】 算法 利用两重for循环i,j分别指向两个狼人; 如何判定撒谎:i和j指向的是狼人,若k所指为i或j,且值data[k]<0,则其没有撒谎,否则判定为撒谎;k所指不为i或j,且值data[k]>0,则其没有撒谎,否则判定...
(PAT 1148) Werewolf - Simple Version (枚举) 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.";...
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
1148 Werewolf - Simple Version (20分) 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#1said:"Player #2 is a werewolf."; player#2said:"Player #3 is a human."; ...
A1148.Werewolf - Simple Version 题意 已知N 名玩家中有 2 ⼈扮演狼⼈⻆⾊,有 2 ⼈说的不是实话,有狼⼈撒谎但并不是所有狼 ⼈都在撒谎。要求你找出扮演狼⼈⻆⾊的是哪⼏号玩家,如果有解,在⼀⾏中按递增顺序输出 2 个狼
#include<vector> #include<queue> #include<cmath> usingnamespacestd; //狼人杀,假设i和j为狼人, v[k] * a[abs(v[k])] <0即"说谎" //条件:撒谎数组lie有两人且1狼1人 intmain(){ intn; cin>>n; vector<int>v(n+1); for(inti=1;i<=n;i++)cin>>v[i];//保存每个人说的话 ...