twitter店面(攒点人品)# JobHunting - 待字闺中
m*n
1 楼
Given a jar with W white beans and R red beans, randomly pick one bean:
1) if it is white, eat it;
2) if it is red, put it back, and randomly pick one again. Eat it regardless
of color.
Write a program to estimate the probability of the last bean being white.
开始以为是个统计模拟问题,被误导浪费了不少时间。后来明白其实就是一个DP问题,
之后code不难。
1) if it is white, eat it;
2) if it is red, put it back, and randomly pick one again. Eat it regardless
of color.
Write a program to estimate the probability of the last bean being white.
开始以为是个统计模拟问题,被误导浪费了不少时间。后来明白其实就是一个DP问题,
之后code不难。