编程介的小学生 2017-10-26 09:43 采纳率: 20.5%
浏览 844
已采纳

Panda's Birthday Present

Description

On Panda's Birthday party, he received a strange present from Jason. The present is a black box with 4 dices in it which is used to play a game. The dice in the box is unusual. Instead of the digits, only red or blue is painted on each side of the dice. Before the first round of the game, the box can repaint every side of every dice red or blue with equal probability. Then for each round of the game, the box will roll the 4 dices and tell the player the number of red side facing up, which is the point the player get. Now, Panda has play it for two rounds and he tell you the point he has got for each round. Can you tell him the expected point he can get for next round.
Input

The first line of the input is number of test case. Each test case contains two integers, pand q, which are the points Panda has got for the first two rounds.(0≤p,q≤4)
Output

For each test case, output the expected point panda can get for the third round. Round the answer to the third digit after the decimal point.
Sample Input

2
2 2
4 4
Sample Output

2.000
2.571

  • 写回答

1条回答 默认 最新

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

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试