Who Wants to be a Millionaire!?
Practice
2 (6 votes)
Mathematics
Open
Approved
Easy
Problem
35% Success 10698 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are on a game show "Who Wants to Be a Millionaire".The host presents you "N" number of closed doors.There is huge prize behind one door while there are sumo wrestlers behind rest of the doors.Initially you are asked to choose a door.After that the host opens (N-2) doors,revealing sumo wrestlers.The host is omniscient and always reveals sumo wrestlers when he opens the doors. The host then says to you.""Do you want to pick the door you have initially chosen or you want to chose the other closed door?".So it's your decision either stick with your original unopened door or switch to the other unopened door.You are good at maths so you will first calculate the probability of winning the prize by switching from the original selection.

INPUT:

the first line contain number of testcases "T". "T" testcases follows then.Each testcase contains the number of doors "N".

OUTPUT:

for each testcase output the probability of winning the prize by switching from the original selection.output upto 6 places of decimal.

Constraint:
1 <= T <= 1000
3 <= N <= 1000

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:20
54 votes
Tags:
Exception handlingMathematicsProbability and StatisticsEasy
Points:20
Tags:
Easy
Points:20
2 votes
Tags:
MathematicsEasyEasy