結果

問題 No.799 赤黒かーどげぇむ
コンテスト
ユーザー nao22b
提出日時 2019-04-13 10:35:26
言語 Elixir
(1.20.4)
コンパイル:
elixirc _filename_
実行:
elixir -e Main.main
結果
AC  
実行時間 300 ms / 2,000 ms
+ 753µs
コード長 411 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 476 ms
コンパイル使用メモリ 77,544 KB
実行使用メモリ 67,216 KB
最終ジャッジ日時 2026-10-09 19:44:02
合計ジャッジ時間 8,240 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

defmodule Main do
    def same_number_count(a, b, c, d) do
        n1 = max(a, c)
        n2 = min(b, d)
        max(0, n2 - n1 + 1)
    end

    def solve(a, b, c, d) do
        (b - a + 1) * (d - c + 1) - same_number_count(a, b, c, d)
    end

    def main do
        [a, b, c, d] = IO.gets("") |> String.trim |> String.split |> Enum.map(&String.to_integer/1)
        solve(a, b, c, d) |> IO.puts
    end
end
0