Cian letter pen questions

A rabbit reproductive problems: a pair of rabbits over four months after birth may be a rabbit, then the first n months later, the number of rabbits. (N = 5, the output 2)

n1 = 1; n2 = 1; n3 = 1; n4 = 1; n5 = n4 + n1.

Using f (n) = f (n-4) + f (n-1) to seek.

(I actually did not think written, hey ... long time did not do such a title)

II 1000 10 coins in the coin, now take n coins, determination of probability containing gold. Required to retain six decimal places.

Test: Input n = 1, 0.010000 output; an input n = 999, the output 1.000000

(N <990 I used to count the probability of selection, I feel I have no problems, but most of the 10% ... n> 990, the output 1.000000)

Published 84 original articles · won praise 18 · views 10000 +

Guess you like

Origin blog.csdn.net/sunandstarws/article/details/104563912