zoj 3468

Dice war is a board game. In each turn, the attacker will choose a pile of dices to attack the defender's pile of dices. They will roll the all dices, and the attacker will win if and only if the total number on all his dices is larger than the defenders. After a successful attack, the attacker's pile of dices will split into two piles, while one of them has only one dice. If the attacker loses, this pile will lose all dices except one. An attack cannot be made with a pile of one single dice.

Input

Multiple cases. Each case contains two number of dices in the attacker's pile and the diffender's pile. In the game, number of dices in a pile will be no more than 8.

Output

For each case, output the probability of attack success in a single line. Error no more than 1e-4 will be accepted.

Sample Input
3 2
2 1
Sample Output
0.7785493827160493
0.8379629629629629
ZOJ月赛的题目,大意是输入a和b所拥有的骰子的数量,求出a掷出的点数比b大的概率。比如输入3和2就是说a有3个骰子,b有2个骰子,
求出a的点数比b大的概率。
因为骰子数量较少,最大只有8个,所以直接暴力解决~~~
 
 
 
 
 
 
 

                
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值