CF 518D(Ilya and Escalator

Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine the escalator load factor.

Let’s assume thatnpeople stand in the queue for the escalator. At each second one of the two following possibilities takes place: either the first person in the queue enters the escalator with probabilityp, or the first person in the queue doesn’t move with probability(1-p), paralyzed by his fear of escalators and making the whole queue wait behind him.

Formally speaking, thei-th person in the queue cannot enter the escalator until people with indices from1toi-1inclusive enter it. In one second only one person can enter the escalator. The escalator is infinite, so if a person enters it, he never leaves it, that is he will be standing on the escalator at any following second. Ilya needs to count the expected value of the number of people standing on the escalator aftertseconds.

Your task is to help him solve this complicated task.

,如你想要拥有完美无暇的友谊,可能一辈子找不到朋友

CF 518D(Ilya and Escalator

相关文章:

你感兴趣的文章:

标签云: