結果
問題 |
No.185 和風
|
ユーザー |
|
提出日時 | 2015-05-30 19:12:02 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 484 bytes |
コンパイル時間 | 3,464 ms |
コンパイル使用メモリ | 74,400 KB |
実行使用メモリ | 56,340 KB |
最終ジャッジ日時 | 2024-07-06 12:46:27 |
合計ジャッジ時間 | 4,756 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 1 |
ソースコード
import java.util.*; public class Wafu { public static void main(String[] arg){ Scanner sc = new Scanner(System.in); int n,temp=0,res=0; 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(); } for(int i = 0;i<n;i++){ if(i ==0){ temp = y[i] - x[i]; res = temp; } if(y[i] - x[i]< 0 || y[i] - x[i] != temp) { res = -1; break; } } System.out.println(res); } }