这题也可以DP 解吧?# JobHunting - 待字闺中
h*g
1 楼
number of combination of integers between 1 and 10, that sum to 15
Problem:
Write a function that takes an array of five integers, each of which is
between 1 and 10,
and returns the number of combination of those integers that sum to 15....
For example, calling the function with the array [1, 2, 3, 4, 5] should
return 1,
while calling it with [5, 5, 10, 2, 3] should return 4
(5 + 10, 5 + 10, 5 + 5 + 2 + 3, 10 + 2 + 3).
Problem:
Write a function that takes an array of five integers, each of which is
between 1 and 10,
and returns the number of combination of those integers that sum to 15....
For example, calling the function with the array [1, 2, 3, 4, 5] should
return 1,
while calling it with [5, 5, 10, 2, 3] should return 4
(5 + 10, 5 + 10, 5 + 5 + 2 + 3, 10 + 2 + 3).