Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
22
Task/McNuggets-problem/Elixir/mcnuggets-problem.elixir
Normal file
22
Task/McNuggets-problem/Elixir/mcnuggets-problem.elixir
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
defmodule Mcnugget do
|
||||
def solve(limit) do
|
||||
0..limit
|
||||
|> MapSet.new()
|
||||
|> MapSet.difference(
|
||||
for(
|
||||
x <- 0..limit,
|
||||
y <- 0..limit,
|
||||
z <- 0..limit,
|
||||
Integer.mod(x, 6) == 0,
|
||||
Integer.mod(y, 9) == 0,
|
||||
Integer.mod(z, 20) == 0,
|
||||
x + y + z <= limit,
|
||||
into: MapSet.new(),
|
||||
do: x + y + z
|
||||
)
|
||||
)
|
||||
|> Enum.max()
|
||||
end
|
||||
end
|
||||
|
||||
Mcnugget.solve(100) |> IO.puts
|
||||
Loading…
Add table
Add a link
Reference in a new issue