|
||||||||||
Extraordinary Tug of WarTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 272 Accepted Submission(s): 2 Problem Description 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: 1. In the approximation, the rope does NOT move continuously. It moves in discrete steps, step length = dt. 2. Every dt unit time, the rope either moves left or right, exactly sqrt(dt) unit length. 3. 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
Sample Output
Source | ||||||||||
|