编程介的小学生 2017-04-02 07:54 采纳率: 20.5%
浏览 756
已采纳

Extraordinary Tug of War

Task

In the game of "tug of war", You're fighting against an extrordinary opponent -- you two teams have exactly the same strength! Yes, this is a so-called "Mirror Match".

Imagine an x-axis along the rope, with origin at the initial position of the center of rope (COR). Then, we can APPROXIMATE the movement of the rope as follows:

In the approximation, the rope does NOT move continuously. It moves in discrete steps, step length = dt.
Every dt unit time, the rope either moves left or right, exactly sqrt(dt) unit length.
The movement of the rope in different steps are independent.
When the step length, dt, goes towards zero, the approximation above goes towards the exact movement.

It's not hard to imagine that, it usually takes too long to move COR far enough from its original position. So the referee decided to adopt a special rule: observe COR in a period of time (t1, t2). If COR keeps in one side during the whole interval, the team on that side wins. If COR had ever returned to its original position during the interval, the game ends with a draw.

The referee wants the length of the observation interval (i.e. t2-t1) be exactly L, and the probability that one of the teams wins (i.e. the game is NOT a draw) be exactly P%, when should he start to observe?

Input

The first line contains a single integer T (T <= 20), the number of test cases. Each case contains two integers L, P (1 <= L <= 1000; 0 < P < 100), explained above.
Output

For each test case, print the case number and t1, rounded to 3 decimal points.
Sample Input

2
1 50
1 10
Sample Output

Case 1: 1.000
Case 2: 0.025

  • 写回答

1条回答 默认 最新

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

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况