結果

問題 No.333 門松列を数え上げ
ユーザー matsuyoshi30matsuyoshi30
提出日時 2016-01-15 22:47:27
言語 Java
(openjdk 23)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 2,020 ms
コンパイル使用メモリ 74,080 KB
実行使用メモリ 54,284 KB
最終ジャッジ日時 2024-09-19 19:20:23
合計ジャッジ時間 3,758 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Test {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String str1 = in.next();
		String str2 = in.next();
		int A = Integer.parseInt(str1);
		int B = Integer.parseInt(str2);
		
		if(A > B) {
			int m = 2000000000 - A;
			int n = A - B - 1;
			System.out.println(m + n);
		}
		if(A < B) {
			int m = A - 1;
			int n = B - A - 1;
			System.out.println(m + n);
		}
	}
}
0