computation of dp table similar approach as knapsack problem
for ( int j = 1 ; j <= 6 ; j ++ ) for ( int cur = 1 ; cur <= j && cur <= len ; cur ++ ) dp [ i , j ] = Math . Max ( dp [ i , j ] , dp [ i - 1 , j - cur ] + maxsum [ cur ] ) ; }