Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Chance of Passing the Quiz

By user.424868 · Limits 1s, 512 MB

Rocky is starting his online quizzes and he has been provided with some passing criteria. The rule of passing the online quiz is to obtain at least a certain mark. Rocky’s friend Gillan is good at computing and Rocky always takes his help in need. Rocky asks gillian about this passing criteria and asks Gillian to help find out his probability of passing the quiz if he guesses the answer of each question randomly from the available options without any thinking. Gillian thought sometime and told Rocky he will provide Rocky a program so that Rocky can estimate in advance his probability of passing the quiz if the number of quiz questions are known early.

A quiz consists of $N$ MCQ questions. Each question has two options: $True$ and $False$. Each question is assigned $1$ mark, so Rocky’s total marks will increase by $1$ for correctly answering each question . Rocky needs to have a score of at least $X\%$ in order to pass the quiz. What is the probability that Rocky will pass the quiz if he guesses the answer for each question randomly from the available options?


There will be $T(1 <= T <= 100)$ tests and then there will be T lines each will have Integer $N (1 <= N <= 50)$ and Integer $X(0 <= X <= 100)$ as input


For each test case, output a single floating point number denoting Rocky’s probability of passing the quiz. Your output should be rounded to exactly 2 digits after the decimal point.


20 65
20 55
30 45
25 65
30 35



75% Solution Ratio

blizzardEarliest, 2w ago

ishaan_007Fastest, 0.0s

obaydullahmhsLightest, 0 B

blizzardShortest, 594B


Login to submit