結果

問題 No.799 赤黒かーどげぇむ
ユーザー nao22bnao22b
提出日時 2019-04-13 10:35:26
言語 Elixir
(1.16.2)
結果
AC  
実行時間 648 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 1,131 ms
コンパイル使用メモリ 55,844 KB
実行使用メモリ 49,932 KB
最終ジャッジ日時 2023-08-29 23:15:49
合計ジャッジ時間 16,522 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 637 ms
49,932 KB
testcase_01 AC 637 ms
47,756 KB
testcase_02 AC 637 ms
49,192 KB
testcase_03 AC 648 ms
49,264 KB
testcase_04 AC 630 ms
49,276 KB
testcase_05 AC 625 ms
49,048 KB
testcase_06 AC 627 ms
49,336 KB
testcase_07 AC 634 ms
49,704 KB
testcase_08 AC 633 ms
49,172 KB
testcase_09 AC 631 ms
49,324 KB
testcase_10 AC 626 ms
49,728 KB
testcase_11 AC 627 ms
49,284 KB
testcase_12 AC 625 ms
49,220 KB
testcase_13 AC 617 ms
49,240 KB
testcase_14 AC 617 ms
49,292 KB
testcase_15 AC 634 ms
49,864 KB
testcase_16 AC 625 ms
49,792 KB
testcase_17 AC 630 ms
49,188 KB
testcase_18 AC 632 ms
49,200 KB
testcase_19 AC 633 ms
49,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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