Optimal game strategy dp

My code is correct ?

my code = https://ide.codingblocks.com/s/292883