/* Grocery problem in Picat. Ported from the Gecode example """ A kid goes into a grocery store and buys four items. The cashier charges $7.11, the kid pays and is about to leave when the cashier calls the kid back, and says "Hold on, I multiplied the four items instead of adding them; I'll try again; Hah, with adding them the price still comes to $7.11". What were the prices of the four items? The model is taken from: Christian Schulte, Gert Smolka, Finite Domain Constraint Programming in Oz. A Tutorial. 2001. Available from: http://www.mozart-oz.org/documentation/fdt/ """ This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go => Item = new_list(4), Item :: 0..711, sum(Item) #= 711, prod(Item) #= 711 * 100*100*100, increasing(Item), % symmetry breaking solve([ffd,split], Item), println(item=Item), nl. % variant go2 => Vs = [A,B,C,D], Vs :: 0..711, A + B + C + D #= 711, A * B * C * D #= 711*100*100*100, A #<= B, B #<= C, C #<= D, solve([ffc,split], Vs), println(Vs).