Editorial for SAC '22 Code Challenge 3 Junior P3 - Normal Probabilities
                Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
                Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Maintain the probability that all these events occur with a double variable denoted as  and initialized to 
.
For each of the following cases, multiply  by their respective probabilities:
If the probability type is A, multiply  by 
;
If the probability type is B, multiply  by 
;
If the probability type is C, multiply  by 
;
If the probability type is D, multiply  by 
;
If the probability type is E, multiply  by 
.
Finally, output  to 
 decimal places.
Time Complexity: 
Bonus: Can you find the probability to multiply by without if-statements?
Hint: The probability type and the probability are sequential and decreasing.
Comments