给出一组数字n[1], n[2], n[3], .... n[x] 和一个数字M.
n[1], n[2], n[3], .... n[x]
我想找到最好的组合
n[a] + n[b] + n[c] + ... + n[?] >= M
组合应该达到达到或超过M所需的最小值,没有其他组合可以获得更好的结果.
将在PHP中执行此操作,因此可以使用PHP库.如果没有,只需一般算法即可.谢谢!
php algorithm math
algorithm ×1
math ×1
php ×1