結果

問題 No.185 和風
ユーザー Lo_OTLo_OT
提出日時 2018-03-13 18:27:00
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 621 bytes
コンパイル時間 3,176 ms
コンパイル使用メモリ 74,036 KB
実行使用メモリ 43,624 KB
最終ジャッジ日時 2024-05-02 02:15:52
合計ジャッジ時間 4,072 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 193 ms
42,156 KB
testcase_01 AC 213 ms
43,624 KB
testcase_02 AC 137 ms
41,180 KB
testcase_03 AC 140 ms
41,208 KB
testcase_04 AC 124 ms
39,924 KB
testcase_05 WA -
testcase_06 AC 215 ms
43,412 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