/* Norwegian Mathematical Olympic problem in Picat. https://mindyourdecisions.com/blog/2017/12/10/delightfully-fruitful-problem-from-the-norwegian-math-olympiad-the-cost-of-fruit/ """ The numbers a, b, and c are positive integers. An apple cost $a, a banana costs $b, and a cherry costs $c. The cost of b apples, b bananas, and a + b cherries is $77. What would be the cost for one apple, two bananas, and one cherry? """ 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 ?=> Total = 77, L = [A,B,C,Y], L :: 1..Total, B*A + B*B + (A+B)*C #= Total, Y #= A + 2*B + C, solve(L), println([a=A,b=B,c=C,y=Y]), fail, nl. go => true.