結果

問題 No.333 門松列を数え上げ
ユーザー mitsuomitsuo
提出日時 2016-05-04 13:56:56
言語 Java
(openjdk 23)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 2,296 ms
コンパイル使用メモリ 74,696 KB
実行使用メモリ 54,216 KB
最終ジャッジ日時 2024-10-05 06:25:54
合計ジャッジ時間 3,506 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

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