-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
517 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
% Coins -- 2007 by Yuce Tekol <[email protected]> | ||
|
||
:- use_module(library('bounds')). | ||
|
||
coins(Count, Total, Solution) :- | ||
% A=1, B=5, C=10, D=50, E=100 | ||
Solution = [A, B, C, D, E], | ||
|
||
Av is 1, | ||
Bv is 5, | ||
Cv is 10, | ||
Dv is 50, | ||
Ev is 100, | ||
|
||
Aup is Total // Av, | ||
Bup is Total // Bv, | ||
Cup is Total // Cv, | ||
Dup is Total // Dv, | ||
Eup is Total // Ev, | ||
|
||
A in 0..Aup, | ||
B in 0..Bup, | ||
C in 0..Cup, | ||
D in 0..Dup, | ||
E in 0..Eup, | ||
|
||
VA #= A*Av, | ||
VB #= B*Bv, | ||
VC #= C*Cv, | ||
VD #= D*Dv, | ||
VE #= E*Ev, | ||
|
||
sum(Solution, #=, Count), | ||
VA + VB + VC + VD + VE #= Total, | ||
|
||
label(Solution). | ||
|
Oops, something went wrong.