結果
問題 | No.185 和風 |
ユーザー | ohagi_1182 |
提出日時 | 2017-10-15 17:19:14 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 582 bytes |
コンパイル時間 | 2,168 ms |
コンパイル使用メモリ | 73,660 KB |
実行使用メモリ | 43,672 KB |
最終ジャッジ日時 | 2024-04-28 21:35:03 |
合計ジャッジ時間 | 4,221 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 186 ms
41,992 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 217 ms
43,152 KB |
testcase_04 | AC | 219 ms
43,672 KB |
testcase_05 | AC | 143 ms
41,132 KB |
testcase_06 | AC | 207 ms
43,112 KB |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] x = new int[n]; int[] y = new int[n]; for(int i = 0 ; i < n ; i++) { x[i] =sc.nextInt(); y[i] = sc.nextInt(); } long[] a = new long[n]; for(int i = 0 ; i < n ; i++) { a[i] = y[i] - x[i]; } for(int i = 0 ; i < n ; i++) { for(int j = i + 1 ; j < n ; j++) { if(a[i] == a[j] && a[i] > 0) { System.out.println(a[i]); return; } else { } } } System.out.println(-1); } }