Submission #15335013


Source Code Expand

Copy
defmodule Main do
def main do
IO.gets("")
|> String.trim()
|> String.to_integer()
|> solve()
|> IO.puts()
end
@doc ~S"""
Sove
## Examples
iex> Main.solve(1900)
100
iex> Main.solve(3000)
0
"""
def solve(n) do
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
defmodule Main do
  def main do
    IO.gets("")
    |> String.trim()
    |> String.to_integer()
    |> solve()
    |> IO.puts()
  end

  @doc ~S"""
  Sove

  ## Examples

      iex> Main.solve(1900)
      100
      iex> Main.solve(3000)
      0

  """
  def solve(n) do
    1..10
    |> Enum.reduce_while(0, fn _, payment ->
      if payment < n, do: {:cont, payment + 1000}, else: {:halt, payment}
    end)
    |> Kernel.-(n)
  end
end

Submission Info

Submission Time
Task A - Payment
User awesomey
Language Elixir (1.10.2)
Score 100
Code Size 463 Byte
Status AC
Exec Time 359 ms
Memory 30888 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 17
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
hand_01.txt AC 354 ms 30696 KB
hand_02.txt AC 342 ms 30852 KB
hand_03.txt AC 347 ms 30812 KB
hand_04.txt AC 345 ms 30668 KB
hand_05.txt AC 350 ms 30816 KB
random_01.txt AC 338 ms 30516 KB
random_02.txt AC 343 ms 30336 KB
random_03.txt AC 342 ms 30616 KB
random_04.txt AC 352 ms 30664 KB
random_05.txt AC 337 ms 30792 KB
random_06.txt AC 359 ms 30868 KB
random_07.txt AC 343 ms 30784 KB
random_08.txt AC 348 ms 30596 KB
random_09.txt AC 346 ms 30624 KB
random_10.txt AC 350 ms 30888 KB
sample_01.txt AC 336 ms 30804 KB
sample_02.txt AC 350 ms 30540 KB


2025-04-05 (Sat)
08:11:14 +00:00