結果

問題 No.799 赤黒かーどげぇむ
ユーザー tentententen
提出日時 2020-11-12 11:46:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 1,986 ms
コンパイル使用メモリ 71,888 KB
実行使用メモリ 58,244 KB
最終ジャッジ日時 2023-09-30 01:13:15
合計ジャッジ時間 5,979 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,744 KB
testcase_01 AC 116 ms
56,020 KB
testcase_02 AC 116 ms
56,400 KB
testcase_03 AC 114 ms
56,128 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 116 ms
56,208 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 115 ms
55,912 KB
testcase_15 AC 116 ms
56,036 KB
testcase_16 AC 115 ms
56,300 KB
testcase_17 AC 118 ms
55,740 KB
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int ans = (b - a + 1) * (d - c + 1);
        ans -= Math.max(0, b - c + 1);
        ans -= Math.max(0, a - d + 1);
        System.out.println(ans);
    }
}
0