Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Department-numbers/Nim/department-numbers.nim
Normal file
13
Task/Department-numbers/Nim/department-numbers.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
type Solution = tuple[p, s, f: int]
|
||||
|
||||
iterator solutions(max, total: Positive): Solution =
|
||||
for p in countup(2, max, 2):
|
||||
for s in 1..max:
|
||||
if s == p: continue
|
||||
let f = total - p - s
|
||||
if f notin [p, s] and f in 1..max:
|
||||
yield (p, s, f)
|
||||
|
||||
echo "P S F"
|
||||
for sol in solutions(7, 12):
|
||||
echo sol.p, " ", sol.s, " ", sol.f
|
||||
Loading…
Add table
Add a link
Reference in a new issue