编程介的小学生 2017-08-13 16:29 采纳率: 20.5%
浏览 750
已采纳

Computer Basketball Game

Description

In a computer basketball game, people can play "one vs. one", which has the following rules: when a player attacks, he may throw 2-point-goal or 3-point-goal. If he makes the goal, he can continue to attack in the next turn. Otherwise, i.e. he misses the goal, the two players grab the rebound, and who gets the rebound attack in the next turn. The player who first gets N (1 <= N <= 30) points will win the game.

In this game, each player has four kinds of properties: the skill of 2-point-goal, the skill of 3-point-goal, the skill of rebound and the skill of defense. (Each skill is described in integers between 1 and 10). Through the statistic data, we can know the functions of skill. We use pt2(i), pt3(i), reb(i) and def(i) to represent the skill of 2-point-goal, the skill of 3-point-goal, the skill of rebound and the skill of defense of player i respectively. Take the case that player 1 attacks while player 2 defends for example, we will have the following conclusion:
1. The probability that player 1 chooses to throw 3-point-goal is pt3(1)/[pt3(1)+pt2(1)], otherwise he throws 2-point-goal.
2. If player 1 throws 3-point-goal, the probability that he makes the goal is 0.8*pt3(1)/[pt3(1)+def(2)], otherwise he misses the goal.
3. If player 1 throws 2-point-goal, the probability that he makes the goal is pt2(1)/[pt2(1)+def(2)], otherwise he misses the goal.
4. If player 1 misses a goal, the probability that he can get the rebound is 0.8*reb(1)/[reb(1)+reb(2)], otherwise player 2 get the rebound.

The case that player 2 attacks while player 1 defends is similar to the description above.

Well, now you are given the skill of your opponent, and you can assign your four kinds of skill in any way, but the sum of these four numbers must be a certain number M (4 <= M <= 40). Assume that you attack first, the problem is what is the maximum probability you win the game by assigning the skill optimally. You should know that once you choose your skills, the skills are fixed in every turn.
Input

The input consists of several test cases. In each test case, there are six integers N, M, pt2(2), pt3(2), reb(2), def(2) in a single line. (Assume you are player 1, and your opponent is player2.)
Output

For each test case, please output the result in a separate line. The result should be rounded to three digits after the decimal point.
Sample Input

19 21 3 5 6 6
Sample Output

0.754

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-08-27 15:15
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站