結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー gemmarogemmaro
提出日時 2020-04-19 16:48:50
言語 Elixir
(1.16.2)
結果
AC  
実行時間 643 ms / 1,000 ms
コード長 567 bytes
コンパイル時間 1,128 ms
コンパイル使用メモリ 55,132 KB
実行使用メモリ 50,820 KB
最終ジャッジ日時 2023-08-30 00:33:03
合計ジャッジ時間 24,070 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 631 ms
49,996 KB
testcase_01 AC 631 ms
49,440 KB
testcase_02 AC 632 ms
49,244 KB
testcase_03 AC 626 ms
50,172 KB
testcase_04 AC 619 ms
49,832 KB
testcase_05 AC 630 ms
49,272 KB
testcase_06 AC 624 ms
49,928 KB
testcase_07 AC 628 ms
49,140 KB
testcase_08 AC 622 ms
49,084 KB
testcase_09 AC 628 ms
49,296 KB
testcase_10 AC 636 ms
49,600 KB
testcase_11 AC 643 ms
48,968 KB
testcase_12 AC 629 ms
49,968 KB
testcase_13 AC 634 ms
49,048 KB
testcase_14 AC 633 ms
49,112 KB
testcase_15 AC 641 ms
49,176 KB
testcase_16 AC 639 ms
49,312 KB
testcase_17 AC 630 ms
49,108 KB
testcase_18 AC 633 ms
50,084 KB
testcase_19 AC 639 ms
49,088 KB
testcase_20 AC 636 ms
49,980 KB
testcase_21 AC 633 ms
49,196 KB
testcase_22 AC 637 ms
50,216 KB
testcase_23 AC 630 ms
50,820 KB
testcase_24 AC 625 ms
49,972 KB
testcase_25 AC 621 ms
49,448 KB
testcase_26 AC 622 ms
48,908 KB
testcase_27 AC 622 ms
49,184 KB
testcase_28 AC 628 ms
50,252 KB
testcase_29 AC 630 ms
49,980 KB
testcase_30 AC 636 ms
49,704 KB
testcase_31 AC 633 ms
49,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main do
    IO.read(:line)
    |> String.trim()
    |> String.split()
    |> Enum.map(&String.to_integer/1)
    |> solve
    |> IO.puts()
  end

  def solve(a) do
    a
    |> Enum.map(fn b ->
      x = b |> rem(3) == 0
      y = b |> rem(5) == 0

      cond do
        x || y ->
          cond do
            x -> 4
            true -> 0
          end +
            cond do
              y -> 4
              true -> 0
            end

        true ->
          b |> to_string |> String.length()
      end
    end)
    |> Enum.sum()
  end
end
0