結果

問題 No.799 赤黒かーどげぇむ
ユーザー GrenacheGrenache
提出日時 2019-04-26 15:03:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 3,159 ms
コンパイル使用メモリ 72,060 KB
実行使用メモリ 56,404 KB
最終ジャッジ日時 2023-08-16 02:37:24
合計ジャッジ時間 7,215 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,500 KB
testcase_01 AC 123 ms
56,084 KB
testcase_02 AC 120 ms
55,744 KB
testcase_03 AC 120 ms
54,424 KB
testcase_04 AC 118 ms
55,964 KB
testcase_05 AC 117 ms
56,256 KB
testcase_06 AC 116 ms
56,200 KB
testcase_07 AC 118 ms
56,404 KB
testcase_08 AC 119 ms
56,224 KB
testcase_09 AC 119 ms
56,188 KB
testcase_10 AC 120 ms
56,028 KB
testcase_11 AC 120 ms
56,344 KB
testcase_12 AC 117 ms
53,880 KB
testcase_13 AC 117 ms
55,840 KB
testcase_14 AC 121 ms
56,352 KB
testcase_15 AC 117 ms
56,144 KB
testcase_16 AC 125 ms
56,068 KB
testcase_17 AC 120 ms
56,300 KB
testcase_18 AC 120 ms
55,456 KB
testcase_19 AC 117 ms
56,184 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