编程介的小学生 2019-06-26 17:24 采纳率: 20.5%
浏览 189

在三国杀游戏中的一个策略计算,怎么才能使用C语言的程序的编写的技术的方法来实现这个程序的编写的

Problem Description
"Killers of Three Kingdoms" is a popular role playing card game designed with the novel Romance of the Three Kingdoms.

The game has four kinds of "Equipment Card": "Armour", "Weapon", "+1 horse", "-1 horse". Each player has an equipped-item area to hold equipments. A player is allowed to own only one of each of these 4 equipments in the equipped-item area. Equipments can be replaced by one of the same kind. However, after the replacement, the previous ones would be discarded. For simplicity, cards not belong to equipment (tool cards, basic cards and so on) are united as "Other Card" ignoring their functions in this problem.

Sun Shangxiang(Nickname: Xiangxiang), the lady with bow and arrows, is one of the favorable characters in this game. Her 2nd character ability - "Warrior Lady" (枭姬xiāo jī in Chinese) is described below:

Whenever an equipped card is discarded from the equipped-item area, Xiangxiang can immediately draw 2 cards from the deck. Note that Xiangxiang cannot voluntarily remove her equipped items. She can only replace them.

Now it is Xiangxiang’s turn. She has a certain amount of cards of each kind in her hand and her equipped-item area is empty. Given the number of cards of each kind in the deck, assume that every card in the deck will be taken with equal probability, and Xiangxiang will always equip the "Equipment Card" once she gets it. What is the expected number of cards Xiangxiang can draw in her action phase?

Input
In the first line there is an integer T, indicates the number of test cases. (T <= 100)

For each case, two lines are given. The first line describes Xiangxiang’s hand cards, 5 integers indicating the number of "Armour", "Weapon", "+1 horse", "-1 horse" and "Other Card" respectively. The second line describes the cards in the deck which has the same format as above. The sum of the 10 integers is no more than 104.

Output
For each case, output "Case k: v" on a single line, in which k is the case number, v is the maximum expected number of cards Xiangxiang can draw round to 2 digits after decimal point.

Sample Input
3

2 0 0 0 0
0 0 0 0 1

0 0 0 5 0
0 0 0 0 9

0 0 0 2 0
0 0 0 1 2

Sample Output
Case 1: 1.00
Case 2: 8.00
Case 3: 2.67

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作