結果

問題 No.799 赤黒かーどげぇむ
ユーザー GrenacheGrenache
提出日時 2019-04-26 15:03:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 3,318 ms
コンパイル使用メモリ 75,852 KB
実行使用メモリ 41,656 KB
最終ジャッジ日時 2024-05-03 12:16:46
合計ジャッジ時間 6,674 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
41,492 KB
testcase_01 AC 115 ms
40,320 KB
testcase_02 AC 130 ms
41,236 KB
testcase_03 AC 113 ms
40,120 KB
testcase_04 AC 124 ms
41,216 KB
testcase_05 AC 124 ms
41,032 KB
testcase_06 AC 125 ms
41,300 KB
testcase_07 AC 124 ms
41,052 KB
testcase_08 AC 128 ms
41,656 KB
testcase_09 AC 118 ms
40,816 KB
testcase_10 AC 112 ms
40,120 KB
testcase_11 AC 127 ms
41,200 KB
testcase_12 AC 121 ms
41,124 KB
testcase_13 AC 121 ms
41,340 KB
testcase_14 AC 114 ms
40,220 KB
testcase_15 AC 127 ms
41,244 KB
testcase_16 AC 123 ms
41,072 KB
testcase_17 AC 126 ms
41,488 KB
testcase_18 AC 125 ms
41,188 KB
testcase_19 AC 120 ms
40,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.Scanner;


public class Main_yukicoder799 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		int ans = 0;
		for (int i = a; i <= b; i++) {
			if (i >= c && i <= d) {
				ans += d - c;
			} else {
				ans += d - c + 1;
			}
		}
		
		pr.println(ans);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
0