結果
| 問題 |
No.784 「,(カンマ)」
|
| コンテスト | |
| ユーザー |
nao22b
|
| 提出日時 | 2019-04-13 17:19:22 |
| 言語 | Elixir (1.18.1) |
| 結果 |
AC
|
| 実行時間 | 553 ms / 2,000 ms |
| コード長 | 456 bytes |
| コンパイル時間 | 978 ms |
| コンパイル使用メモリ | 62,372 KB |
| 実行使用メモリ | 56,256 KB |
| 最終ジャッジ日時 | 2024-12-31 02:47:07 |
| 合計ジャッジ時間 | 9,524 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
defmodule Main do
def solve("", acc), do: acc
def solve(s, acc) do
l = String.at(s, -1)
ss = String.slice(s, 0..-2)
ac = append(l, acc, String.length(acc))
solve(ss, ac)
end
def append(l, acc, len) when rem(len, 4) == 3 do
l <> "," <> acc
end
def append(l, acc, _) do
l <> acc
end
def main do
s = IO.gets("") |> String.trim
IO.puts solve(s, "")
end
end
nao22b