結果

問題 No.185 和風
ユーザー Lo_OT
提出日時 2018-03-13 18:28:03
言語 Java
(openjdk 23)
結果
AC  
実行時間 210 ms / 1,000 ms
コード長 622 bytes
コンパイル時間 2,049 ms
コンパイル使用メモリ 74,604 KB
実行使用メモリ 56,876 KB
最終ジャッジ日時 2024-11-22 11:50:30
合計ジャッジ時間 3,797 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

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