結果
問題 | No.185 和風 |
ユーザー | ohagi_1182 |
提出日時 | 2017-10-15 17:15:37 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 580 bytes |
コンパイル時間 | 2,243 ms |
コンパイル使用メモリ | 79,640 KB |
実行使用メモリ | 43,632 KB |
最終ジャッジ日時 | 2024-04-28 21:34:59 |
合計ジャッジ時間 | 4,497 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 182 ms
41,688 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 213 ms
43,468 KB |
testcase_04 | AC | 219 ms
43,444 KB |
testcase_05 | AC | 154 ms
41,504 KB |
testcase_06 | AC | 207 ms
43,372 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(); } int[] a = new int[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); } }