Project Euler #151: Paper sheets of standard sizes: an expected-value problem.

  • + 0 comments

    That's not what it's asking. If the new guy opens the envelope and sees 0100, then there is one piece of paper inside. Count=1. He'll cut it up, keep the smallest one, and produce 0011. The next time he goes to the envelope, it will have two pieces of paper, so Count is unchanged at 1. With a 50-50 chance, he'll grab the larget piece (A2), split it, keep half, and put the other half back into the envelope: 0002. The next time, there are two pieces, so we still have Count=1, he'll keep one resulting in: 0001; Finally, for the last batch, he opens the envelope to find one piece of paper, so we increment Count=2. Go through all possible paths, count # of times we have a single paper, compute expected value.

    • 0100 -> 0011 -> 0002 -> 0001 -> 0000, Count=2, Prob=0.5
    • 0100 -> 0011 -> 0010 -> 0001 -> 0000, Count=3, Prob=0.5

    Expected # times he sees a single piece of paper = 0.5*2 + 0.5*3 = 5/2.