結果
| 問題 | 
                            No.333 門松列を数え上げ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-04-03 23:09:42 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 633 bytes | 
| コンパイル時間 | 2,126 ms | 
| コンパイル使用メモリ | 73,932 KB | 
| 実行使用メモリ | 54,168 KB | 
| 最終ジャッジ日時 | 2024-10-02 13:04:55 | 
| 合計ジャッジ時間 | 3,901 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 5 WA * 2 | 
ソースコード
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);
    }
}