Premium problem34. At Least One Impression Viewed

Easy Locked

An advertisement gets n independent impressions, and each one is actually viewed with probability p. Return the probability that at least one is viewed.

Go through the complement: the only way to get none is for all n to be missed.

Input

n = 10
p = 0.2

Output

0.8926258175999999

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)