I’a new in Clingo and I have a task to solve which is below
We have coins: 1 cent, 2 cents, 5 cents, 10 cents, 20 cents, 50 cents, 1 dollar and 2 dollars. How many ways can you get 2 dollars using any number of coins?
I’ve tried to solve this but only received 8 resulsts which isn’ correct. I found that it should be some over 7.2k possibilities.
coins(a,1;b,2; c,5; d,10; e,20; f,50; g,100; h,200).
#const goal=200.
{selected(I)} :- coins(I, W).
1 { selected(I,J) : J=1..2 } 1 :- selected(I).
:- #sum {J*W,X : coins(X, W), selected(X), selected(X,J)} != goal.
#show selected/2.
I was looking for resolution to this problem but nah.
Tried to solve this but I’m doing something wrong. Help me find solution
New contributor
Już Oglądam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.