Nice and easy dp problem!!!!!!
First memorize state for all n and then use it for further simulation.
consider boolen array of size as specified
Mark arr[0]=0
for any i ;
Now three conditions possible :
arr[i]=1 if arr[i-1]=0
arr[i]=1 if arr[i-K]=0 ===>>>> Use up these conditions to memorize your array
arr[i]=1 if arr[i-L]=0
These conditions is such that if boy loses on i-1/i-k/i-l position then he could win next up by sweeping up 1/k/l coins and will win the game.!!!
First memorize state for all n and then use it for further simulation.
consider boolen array of size as specified
Mark arr[0]=0
for any i ;
Now three conditions possible :
arr[i]=1 if arr[i-1]=0
arr[i]=1 if arr[i-K]=0 ===>>>> Use up these conditions to memorize your array
arr[i]=1 if arr[i-L]=0
These conditions is such that if boy loses on i-1/i-k/i-l position then he could win next up by sweeping up 1/k/l coins and will win the game.!!!
Bhai
ReplyDelete