1. 程式人生 > >HDU 4576(概率DP+滾動陣列)

HDU 4576(概率DP+滾動陣列)

Michael has a telecontrol robot. One day he put the robot on a loop with n cells. The cells are numbered from 1 to n clockwise. 
At first the robot is in cell 1. Then Michael uses a remote control to send m commands to the robot. A command will make the robot walk some distance. Unfortunately the direction part on the remote control is broken, so for every command the robot will chose a direction(clockwise or anticlockwise) randomly with equal possibility, and then walk w cells forward.  Michael wants to know the possibility of the robot stopping in the cell that cell number >= l and <= r after m commands.