結果

問題 No.185 和風
ユーザー Lo_OT
提出日時 2018-03-13 18:27:00
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 621 bytes
コンパイル時間 4,406 ms
コンパイル使用メモリ 74,156 KB
実行使用メモリ 43,760 KB
最終ジャッジ日時 2024-11-22 11:49:10
合計ジャッジ時間 3,872 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
     public static void main(String []args){
         Scanner in = new Scanner(System.in);
         int loops = in.nextInt();
         int x = in.nextInt(), y = in.nextInt();
         int ans = y - x;
         
         if(ans < 0){
             System.out.println(-1);
             return;
         }
         
         while(in.hasNextInt()){
             x = in.nextInt();
             y = in.nextInt();
             if(ans != (y - x)){
                 System.out.println(-1);
                 return;
             }
         }
         System.out.println(ans);
     }
}
0