add 1112, Dynamic programming, consider add every element and calculate the best one,then store it in array