結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
54,144 KB
testcase_01 AC 120 ms
53,972 KB
testcase_02 AC 117 ms
54,024 KB
testcase_03 AC 106 ms
53,020 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 104 ms
53,028 KB
testcase_08 AC 112 ms
54,008 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){
			c=2000000000-a;
		}
		
        // 標準出力に書き出す。
        System.out.println(c);
    }
}
0