結果

問題 No.333 門松列を数え上げ
ユーザー mitsuomitsuo
提出日時 2016-05-04 13:56:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 2,458 ms
コンパイル使用メモリ 75,252 KB
実行使用メモリ 54,340 KB
最終ジャッジ日時 2024-04-15 11:17:18
合計ジャッジ時間 4,623 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
54,112 KB
testcase_01 AC 157 ms
54,180 KB
testcase_02 AC 148 ms
54,340 KB
testcase_03 AC 151 ms
54,176 KB
testcase_04 AC 153 ms
54,004 KB
testcase_05 AC 155 ms
54,208 KB
testcase_06 AC 153 ms
54,104 KB
testcase_07 AC 151 ms
54,212 KB
testcase_08 AC 160 ms
54,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] input = new String[1];
		int i = 0;
		while (sc.hasNext()) {
			input[i] = sc.nextLine();
			i++;
		}

		System.out.println(solve(input));

		sc.close();
	}

	public static long solve(String[] in) {
		long a = Long.valueOf(in[0].split(" ")[0]);
		long b = Long.valueOf(in[0].split(" ")[1]);
		if (b > a) {
			// b > a > c || b > c > a;
			return a - 1L + b - a - 1L;
		} else {
			// a > c > b
			return 2000000000L - b - 1L;
		}
	}
}
0