https://www.hackerrank.com/challenges/s10-binomial-distribution-2
In this challenge, we go further with binomial distributions.
Task
A manufacturer of metal pistons finds that, on average, 12% of the pistons they manufacture are rejected because they are incorrectly sized. What is the probability that a batch of 10 pistons will contain:
No more than 2 rejects?
At least 2 rejects?
Input Format
A single line containing the following values (denoting the respective percentage of defective pistons and the size of the current batch of pistons):
12 10
Output Format.
Print the answer to each question on its own line:
- The first line should contain the probability that a batch of 10 pistons will contain no more than 2 rejects.
- The second line should contain the probability that a batch of 10 pistons will contain at least 2 rejects.
Round both of your answers to a scale of 3 decimal places (i.e., 1.234 format).