結果

問題 No.333 門松列を数え上げ
ユーザー TakaTaka
提出日時 2016-04-03 23:09:42
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 633 bytes
コンパイル時間 2,418 ms
コンパイル使用メモリ 74,208 KB
実行使用メモリ 56,248 KB
最終ジャッジ日時 2024-04-10 11:05:26
合計ジャッジ時間 4,037 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
54,120 KB
testcase_01 AC 131 ms
53,864 KB
testcase_02 AC 131 ms
54,244 KB
testcase_03 AC 133 ms
54,240 KB
testcase_04 WA -
testcase_05 AC 132 ms
53,988 KB
testcase_06 WA -
testcase_07 AC 145 ms
54,392 KB
testcase_08 AC 134 ms
53,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
		
        // int 1つ分を読み込む
        int a = sc.nextInt();
		
        // int 1つ分を読み込む
        int b = sc.nextInt();
		
		int c=0;
		
		if(a<b){
			if(a==1 && b==2)	c=0;
			else if(a+1==b)	c=a-1;
			else	c=(b-a-1)+(a-1);
		}else if(a>b){
			if(a==2000000000)	c=a-b-1;
			else	c=2000000000-a;
		}
		
        // 標準出力に書き出す。
        System.out.println(c);
    }
}
0