Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
22
Task/McNuggets-problem/Elixir/mcnuggets-problem.ex
Normal file
22
Task/McNuggets-problem/Elixir/mcnuggets-problem.ex
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