Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 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