Imagine tossing a coin n times. The probablility that the coin lands "heads" all n times is much less, say, than the probability that the coin lands "heads" for half of the tosses and "tails" for half of the tosses. In this problem, you are to compute the probability that a sequence of n coin flips results in a particular number of heads. To make matters more interesting, the coins being flipped are not necessarily "fair," in the sense that they need not have the same probability of landing "heads" as "tails."
probability = x.xxxE-ywhere each x is a decimal digit (the first is nonzero) and each y is a decimal integer with no leading zeroes or spaces. The number
x.xxxE-yshould represent in scientific notation (x.xxx * 10^-y) the probability that a sequence of N coin tosses results in exactly H heads with a coin biased according to the specified probability of landing heads. The output exponent y will always fit into a signed integer.
1 1 0.25 2 0 0.1 8271 8271 0.5
probability = 2.500E-1 probability = 8.100E-1 probability = 1.517E-2490