AAA*_*AAA 3 prolog clpfd eclipse-clp
solve(Amounts) :-
Total = 1505,
Prices = [215, 275, 335, 355, 420, 580],
length(Prices, N),
length(Amounts, N),
Amounts :: 0..Total//min(Prices),
Amounts * Prices #= Total,
labeling(Amounts).
Run Code Online (Sandbox Code Playgroud)
没有什么问题.这是来自http://eclipseclp.org/examples/xkcd287.ecl.txt的示例,如果您没有省略该行
:- lib(ic).
Run Code Online (Sandbox Code Playgroud)
加载区间约束求解器,它在ECLiPSe Prolog中可以正常工作.