結果

問題 No.799 赤黒かーどげぇむ
ユーザー eagleeagle
提出日時 2022-06-16 14:37:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 759 bytes
コンパイル時間 2,675 ms
コンパイル使用メモリ 74,560 KB
実行使用メモリ 41,540 KB
最終ジャッジ日時 2024-04-16 02:35:32
合計ジャッジ時間 6,213 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
41,508 KB
testcase_01 AC 132 ms
41,456 KB
testcase_02 AC 132 ms
41,520 KB
testcase_03 WA -
testcase_04 AC 134 ms
41,280 KB
testcase_05 AC 133 ms
41,344 KB
testcase_06 AC 130 ms
41,400 KB
testcase_07 WA -
testcase_08 AC 130 ms
41,468 KB
testcase_09 AC 129 ms
41,224 KB
testcase_10 AC 133 ms
41,440 KB
testcase_11 AC 130 ms
41,328 KB
testcase_12 AC 117 ms
40,236 KB
testcase_13 AC 132 ms
41,484 KB
testcase_14 WA -
testcase_15 AC 127 ms
41,540 KB
testcase_16 AC 130 ms
41,052 KB
testcase_17 WA -
testcase_18 AC 129 ms
41,296 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//赤い箱のカードの下限
		int A = sc.nextInt();
		//赤い箱のカードの上限
		int B = sc.nextInt();
		//黒い箱のカードの下限
		int C = sc.nextInt();
		//黒い箱のカードの上限
		int D = sc.nextInt();
		//赤い箱のカードの種類
		int red = B - A + 1;
		//黒い箱のカードの種類
		int black = D - C + 1;
		int ans = red * black;
		int ll;
		if(A > C) {
			ll = A;
		} else {
			ll = C;
		}
		int ul;
		if(B > D) {
			ul = D;
		} else {
			ul = B;
		}
		int num = ul - ll + 1;
		ans -= ul - ll + 1;
		System.out.println(ans);
	}
}
0