結果

問題 No.185 和風
ユーザー Lo_OTLo_OT
提出日時 2018-03-13 18:28:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 184 ms / 1,000 ms
コード長 622 bytes
コンパイル時間 4,530 ms
コンパイル使用メモリ 71,096 KB
実行使用メモリ 58,336 KB
最終ジャッジ日時 2023-08-14 14:10:30
合計ジャッジ時間 4,303 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 168 ms
55,796 KB
testcase_01 AC 184 ms
58,292 KB
testcase_02 AC 107 ms
56,008 KB
testcase_03 AC 118 ms
56,072 KB
testcase_04 AC 114 ms
55,772 KB
testcase_05 AC 110 ms
55,944 KB
testcase_06 AC 179 ms
58,336 KB
権限があれば一括ダウンロードができます

ソースコード

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