[eclipse-clp-users] 7.11 puzzle

From: Sergey Dymchenko <kit1980_at_gmail.com>
Date: Tue, 13 Sep 2011 01:02:11 +0300
Hi!

I'm trying to solve this puzzle: http://programmingpraxis.com/2009/11/27/7-11/

Here is my very straightforward code:

:- lib(ic).
solve :-
    Sum = 711,
    Product = 711,
    Prices = [A, B, C, D],
    A #> 0, B #> 0, C #> 0, D #> 0,
    A + B + C + D #= Sum,
    A * B * C * D #= Product * 1000000,
    labeling(Prices),
    writeln(Prices).

It works, but it's too slow.
Is there any way to speed it up without being too clever and
explicitly say to ECLiPSe that the prices of the four items must come
from the list of divisors of 711?

Sergey.
Received on Mon Sep 12 2011 - 22:02:18 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET