IPL1 - IPL - CRICKET TOURNAMENT

NOTE: This problem needs knowledge about the game cricket.

Those who know the basics about IPL can skip the first paragraph.

IPL is one of the famous cricket tournaments. Every match is played between two teams. Each team has eleven players. When the first team bats, the second team bowls. The second team’s aim is to get more score/runs than the first team and the first team’s aim is to defend their score. Each team can bat either until the end of 20 overs or until they lose 10 wickets. 6 balls are bowled every over.

The possible things that can happen in any ball are dot-ball, 1 run, 2 runs, 3 runs, 4 runs, 5 runs, 6 runs, wide, no-ball, wicket. For any no-ball or a wide, 1 run is granted and the ball is not counted. Assume that these things can happen with equal probability.

You are given the overs gone, the current score/wickets and the target. Find the winning probability of the chasing team.

Input

The first line consists of an integer t, denoting the number of test cases. Then for the next t lines, each test case consists of three inputs. The overs, current score and the target score.

Output

For each test case output the winning probability (in percentage) of the chasing team.

Note: The first two decimal places in its representation should be printed without rounding.

Constraints

1 <= t <= 1000

0.0 <= Overs <= 20.0

0<= Score <= 300

0<= Wickets <= 10

Score <= Target <= 300

Example

Input:
10
19.4 129/9 129
20.0 100/10 100
19.5 0/9 100
19.5 0/0 1
0.0 0/0 300
0.0 0/0 200
0.0 0/0 100
10.0 0/0 100
10.0 0/5 100
13.5 112/4 222

Output:
100.00
100.00
0.00
80.00
18.02
61.65
97.60
97.60
55.49
35.84

Added by:cegprakash
Date:2012-05-10
Time limit:3.412s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU

hide comments
2017-09-12 12:44:28 [Rampage] Blue.Mary
To those who don't know anything about game "CRICKET" like me:
- The whole game consists of 20 overs with 6 balls each. The input "19.4" means there are 19 overs completed, so it's the 20-th(1-based) over now, with 4 balls already taken.
- The chasing team loses if it doesn't reach the target score when (A) 20 overs completed, OR (B) already taken 10 "wickets". It wins if it reaches the target score without completing 20 overs AND without taking 10 "wickets".
- When a "ball" is triggered, exactly one of the following 10 things will happen: getes 0-6 score, take 1 "wicket", or "wide", "no-ball", each with probability 10%. When one of the last two things happen, the ball is not counted and the team gets one score; otherwise the ball is counted.

Last edit: 2017-09-12 12:50:04
2015-08-28 13:22:05
Is this [spoiler]?

Last edit: 2018-01-09 21:25:59
2014-08-14 08:32:49 AAKASH TYAGI
nice problem
but has some I/O issues
2014-08-12 16:14:33 Archit Jain
finally AC
2012-10-03 06:04:12 ISHAN RAJ JAIN
Why am I getting WA?? I am getting right answer for test cases shown above. Submission id 7775474
2012-07-02 12:45:43 cegprakash
No free hits ;)
2012-06-28 13:31:12 johnny
no free hits??? :P
2012-06-19 05:54:11 pardeep kumar
can anybody give a hint about the approach ...i am not getting where to start
2012-06-14 15:43:48 cegprakash
@Ranjith Mudalaiyar: Yes. But I'm not interested in seeing a lot of TLEs in submissions page
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.