GAME OF DICE
Practice
5 (1 votes)
Medium
Problem
25% Success 66 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Daenerys Targaryen and Tyrion Lannister are playing a game called game of dice.There's also a huge betting on who is to win this game.Due to tight competition between Daenerys Targaryen and Tyrion Lannister , Lord Varys is unable to decide on whom to bet.The dice used here is a special one . It has 6 sides in which 4 sides are numbered 1,2,3,4 and one side is colored green and other side is red. A person can throw the dice at most 100 times(attempts) and increase his score by the number shown on the dice.Each player has 10 lifes. If he gets red side then he need to use one of the 10 lifes to continue the game and If he gets green color he gets bonus of 5 points and he can re-throw the dice for that particular attempt. Here first Daenerys Targaryen plays her game by using her 100 attempts and sets the target for Tyrion Lannister. Then, Tyrion Lannister has to score target set by the Daenerys Targaryen to win the game.Tyrion Lannister finishes some part of the game, and still Lord Varys is confused on whom to bet. Tyrion Lannister's total attempts finished until then and lifes used, current score and target score are given. So become the bird of Lord Varys and help him by telling the percentage of winning probability of Tyrion Lannister.The dice is unbiased which means probability of occurence of all the sides are equal.

Input:

First line of input contains total number of test cases T. Each test case consists of four integers a , l ,c ,t which are attempts completed,lifes used, current score and target scores respectively.

Output:

For each test case output the percentage of winning probability in which after decimal there should be only two decimals and percentage should not be rounded.

Constraints:

0<=a<=100.
0<=l<=10.
0<=c<=t<=250.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
Tags:
Dynamic ProgrammingAlgorithms3 DimensionalMedium
Points:30
1 votes
Tags:
AlgorithmsMedium
Points:30
2 votes
Tags:
Medium