結果
問題 | No.185 和風 |
ユーザー |
👑 ![]() |
提出日時 | 2015-06-24 17:55:28 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 636 bytes |
コンパイル時間 | 2,188 ms |
コンパイル使用メモリ | 72,640 KB |
実行使用メモリ | 58,684 KB |
最終ジャッジ日時 | 2023-09-22 00:33:32 |
合計ジャッジ時間 | 4,323 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 174 ms
55,968 KB |
testcase_01 | AC | 201 ms
58,368 KB |
testcase_02 | AC | 199 ms
58,092 KB |
testcase_03 | AC | 200 ms
58,128 KB |
testcase_04 | AC | 201 ms
58,060 KB |
testcase_05 | WA | - |
testcase_06 | AC | 197 ms
58,684 KB |
ソースコード
import java.util.ArrayList; import java.util.HashSet; import java.util.Scanner; import java.util.TreeSet; public class Main { static int N; static int[] X,Y; public static int solve(){ int answer = Y[0] - X[0]; if (answer < 0) return -1; for (int i = 1; i < N; i++) { if (Y[i] - X[i] != answer) return -1; else continue; } return answer; } public static void main(String[] args){ Scanner S = new Scanner(System.in); N = S.nextInt(); X = new int[N]; Y = new int[N]; for (int i = 0; i < N; i++) { X[i] = S.nextInt(); Y[i] = S.nextInt(); } System.out.println(solve()); } }