結果

問題 No.799 赤黒かーどげぇむ
ユーザー Beat7501Beat7501
提出日時 2019-03-28 17:32:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 2,810 ms
コンパイル使用メモリ 74,956 KB
実行使用メモリ 56,076 KB
最終ジャッジ日時 2024-04-21 08:42:21
合計ジャッジ時間 6,439 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 155 ms
53,992 KB
testcase_01 AC 157 ms
53,940 KB
testcase_02 AC 158 ms
53,752 KB
testcase_03 AC 157 ms
54,272 KB
testcase_04 AC 156 ms
53,664 KB
testcase_05 AC 157 ms
54,256 KB
testcase_06 AC 152 ms
53,964 KB
testcase_07 AC 153 ms
53,948 KB
testcase_08 AC 153 ms
53,804 KB
testcase_09 AC 153 ms
54,124 KB
testcase_10 AC 156 ms
54,280 KB
testcase_11 AC 154 ms
53,744 KB
testcase_12 AC 151 ms
54,296 KB
testcase_13 AC 156 ms
54,288 KB
testcase_14 AC 152 ms
53,996 KB
testcase_15 AC 154 ms
53,768 KB
testcase_16 AC 157 ms
53,852 KB
testcase_17 AC 155 ms
54,228 KB
testcase_18 AC 156 ms
53,984 KB
testcase_19 AC 157 ms
56,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Yuki799{
	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 aka = b-a+1;
		int kuro = d-c+1;
		int dab = 0;
		if((a < c && d < b)||(c < a && b < d)){
			if(a < c && d < b){
				dab = d-c+1;
			}else{
				dab = b-a+1;
			}
		}else{
			dab = a<c?Math.max(0,b-c+1):Math.max(0,d-a+1);
		}
		System.out.println(aka*kuro-dab);
	}
}
0