結果
問題 | No.185 和風 |
ユーザー | kenji_shioya |
提出日時 | 2016-06-19 06:34:04 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 546 bytes |
コンパイル時間 | 3,563 ms |
コンパイル使用メモリ | 80,096 KB |
実行使用メモリ | 43,672 KB |
最終ジャッジ日時 | 2024-04-19 08:28:42 |
合計ジャッジ時間 | 5,264 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 165 ms
42,420 KB |
testcase_01 | AC | 195 ms
43,076 KB |
testcase_02 | AC | 194 ms
43,016 KB |
testcase_03 | AC | 195 ms
43,672 KB |
testcase_04 | AC | 201 ms
43,532 KB |
testcase_05 | WA | - |
testcase_06 | AC | 200 ms
43,076 KB |
ソースコード
import java.util.*; public class Exercise96{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] x = new int[n][2]; for(int i = 0; i < n; i++){ x[i][0] = sc.nextInt(); x[i][1] = sc.nextInt(); } int a = x[0][1] - x[0][0]; if(a < 0){ System.out.println(-1); return; } for(int i = 1; i < n; i++){ if(x[i][1] - x[i][0] != a){ System.out.println(-1); return; } } System.out.println(a); } }