結果

問題 No.799 赤黒かーどげぇむ
ユーザー キョウチクキョウチク
提出日時 2022-06-01 13:43:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 671 bytes
コンパイル時間 1,974 ms
コンパイル使用メモリ 76,380 KB
実行使用メモリ 58,576 KB
最終ジャッジ日時 2023-10-21 00:48:19
合計ジャッジ時間 6,701 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
58,312 KB
testcase_01 AC 148 ms
58,372 KB
testcase_02 AC 153 ms
58,148 KB
testcase_03 AC 142 ms
57,800 KB
testcase_04 AC 153 ms
58,488 KB
testcase_05 AC 158 ms
58,568 KB
testcase_06 AC 149 ms
58,468 KB
testcase_07 AC 142 ms
58,448 KB
testcase_08 AC 151 ms
58,368 KB
testcase_09 AC 135 ms
57,716 KB
testcase_10 AC 153 ms
58,488 KB
testcase_11 AC 158 ms
58,476 KB
testcase_12 AC 146 ms
56,164 KB
testcase_13 AC 152 ms
58,380 KB
testcase_14 AC 148 ms
58,372 KB
testcase_15 AC 156 ms
58,476 KB
testcase_16 AC 155 ms
58,576 KB
testcase_17 AC 160 ms
56,684 KB
testcase_18 AC 131 ms
57,724 KB
testcase_19 AC 156 ms
58,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc=new Scanner(System.in);
        String[] line;
        String result="";
        line=sc.nextLine().split(" ");
        int a=Integer.parseInt(line[0]);
        int b=Integer.parseInt(line[1]);
        int c=Integer.parseInt(line[2]);
        int d=Integer.parseInt(line[3]);
        int puttern=(b-a+1)*(d-c+1);
        int r=b;
        if(d<r) r=d;
        int l=a;
        if(l<c) l=c;
        int equals=r-l+1;
        if(equals<0) equals=0;
        result+=puttern-equals;
        System.out.println(result);
    }
}
0