编程介的小学生 2017-10-19 23:53 采纳率: 20.5%
浏览 827
已采纳

A Game In The Darkness

问题描述 :

It’s a new game which is a little different from those you’ve played before, though it has a very similar name: the game of killing. Now, please pay attention to the instruction below.
There’re 12 players in this game: 2 policemen, 2 killers, 1 doctor, 1 sniper, 1 butterfly, 4 civilians and 1 judge. Here’re the events happen everyday:
-Night falls.
-The killers hang out to kill one person. If they successfully kill a policeman (that’s say, the policeman isn’t saved by the doctor), they’ll each get 10 points. A killer can’t kill himself.
-The policemen search for the killers. They can ask the judge for help, and the judge will tell them whether their suspicion is right or not. If the person the policemen find is a killer, they’ll each get 5 points. The policemen can’t kill the killers on their own.
-The doctor can give any person except the judge an injection. If the person is killed by killer in the first event, the doctor can relive the person and get 5 points. An injection is called useless when it’s given to a person who isn’t killed by the killers. If a person gets two useless injections in total, he’ll die. If the person killed by the doctor is a killer or the butterfly, the doctor will get 5 points. Otherwise, the doctor will lose 5 points. The doctor can give himself an injection.
-The sniper has one bullet that can kill one person in the game and the doctor can’t relive the dead. Every night, the sniper should make a decision whether to give the shot or not. After he kills someone, he’ll be a civilian. If he kills the killer, he’ll get 5 points, and if he kills the policeman, he’ll lose 5 points.
-The butterfly can take action only once per night. If she finds the policeman, the policeman will die, and she’ll get 10 points.
-If the killers, sniper or the butterfly choose the same victim, they’ll all get their points.
-The day dawns.
-The judge announces the dead. If you can tell the result now, the game ends. Otherwise, every player who is still alive votes for one person who he thinks is his opponent. The person who gets the most votes will be killed. If there’s a tie, nobody will be killed.
The game will be over when both of the policemen die or both of the killers die. The policemen, the doctor, the sniper and the civilians are on one side, and the killers and the butterfly are on the other side. At the end of the game, every member of the winning side will get 10 points. If both the policemen and the killer are killed, nobody gets extra points.
Your task is to play the judge role and calculate the scores every player gets.
输入:

The fist line of the input file is a single integer t, which is the number of the test cases. For each case, the first line is a single integer r, which is the number of rounds the game lasts. The first line of each round contains the player’s number for different roles in the order: Killer 1, Killer 2, Policeman 1, Policeman 2, Doctor, Sniper, Butterfly, Civilian 1, Civilian 2, Civilian 3 and Civilian 4. The players are numbered from 1 to 11. Then comes several lines indicate the events happen everyday. The first line of each day is a single integer v which is the number of the player who is killed by the killers. The second line is the number of the player who is suspected by the policemen. The third line is the number of the player who is given an injection by the doctor. The forth line is the number of the player who is shot by the sniper, and if the number is 0, it means the sniper doesn’t give his shot. The fifth line is the number of the player who is found by the butterfly. The sixth line contains n integers which indicate the person everyone vote for. If the integer is 0, it means this person disclaim the vote (the dead has to disclaim no matter who he votes for). If the policemen or the killers are killed in the last night, there won’t be any vote then. You can assume that the game won’t get an end until you process all the data. At the very beginning, everyone has 0 score.
输出:

The fist line of the input file is a single integer t, which is the number of the test cases. For each case, the first line is a single integer r, which is the number of rounds the game lasts. The first line of each round contains the player’s number for different roles in the order: Killer 1, Killer 2, Policeman 1, Policeman 2, Doctor, Sniper, Butterfly, Civilian 1, Civilian 2, Civilian 3 and Civilian 4. The players are numbered from 1 to 11. Then comes several lines indicate the events happen everyday. The first line of each day is a single integer v which is the number of the player who is killed by the killers. The second line is the number of the player who is suspected by the policemen. The third line is the number of the player who is given an injection by the doctor. The forth line is the number of the player who is shot by the sniper, and if the number is 0, it means the sniper doesn’t give his shot. The fifth line is the number of the player who is found by the butterfly. The sixth line contains n integers which indicate the person everyone vote for. If the integer is 0, it means this person disclaim the vote (the dead has to disclaim no matter who he votes for). If the policemen or the killers are killed in the last night, there won’t be any vote then. You can assume that the game won’t get an end until you process all the data. At the very beginning, everyone has 0 score.
样例输入:

1
1
1 2 3 4 5 6 7 8 9 10 11
3
6
5
1
9
0 4 0 2 4 4 4 4 4 4 4
样例输出:

20
20
0
0
0
5
10
0
0
0
0

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题