When i is odd
if ( i % 2 == 1 ) { int temp = Math . Max ( ( Math . Max ( dp [ i - 3 , 1 ] , dp [ i - 3 , 0 ] ) ) , Math . Max ( dp [ i - 2 , 1 ] , dp [ i - 2 , 0 ] ) ) ; dp [ i , 1 ] = a [ i - 1 ] + temp ; dp [ i , 0 ] = Math . Max ( ( Math . Max ( a [ i - 2 ] + dp [ i - 2 , 0 ] , a [ i - 2 ] + dp [ i - 3 , 1 ] ) ) , Math . Max ( a [ i - 2 ] + dp [ i - 3 , 0 ] , a [ i - 3 ] + dp [ i - 3 , 0 ] ) ) ; }