結果
| 問題 | No.2051 Divide |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-08-12 04:15:01 |
| 言語 | Elixir (1.20.3) |
| 結果 |
AC
不安定
|
| 実行時間 | 323 ms / 2,000 ms |
| + 592µs | |
| コード長 | 668 bytes |
| 記録 | |
| コンパイル時間 | 538 ms |
| コンパイル使用メモリ | 77,032 KB |
| 実行使用メモリ | 66,264 KB |
| 最終ジャッジ日時 | 2026-08-25 00:22:17 |
| 合計ジャッジ時間 | 11,241 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
defmodule Main do
def input, do: IO.read(:line) |> String.trim
def ii, do: input() |> String.to_integer
def li, do: input() |> String.split |> Enum.map(&String.to_integer/1)
def yn(b), do: IO.puts(if b, do: "Yes", else: "No")
def divisors(n) do
_divisors(1, n) |> MapSet.new |> Enum.sort
end
defp _divisors(x, n) do
cond do
x * x > n -> []
rem(n, x) == 0 -> [x, div(n, x) | _divisors(x+1, n)]
true -> _divisors(x+1, n)
end
end
def main do
[a, b] = li()
for d <- divisors(a), reduce: 0 do
s ->
s + case rem(d, b) do
0 -> 1
_ -> 0
end
end
|> IO.puts
end
end
norioc