結果
問題 | No.185 和風 |
ユーザー |
![]() |
提出日時 | 2018-05-14 12:42:37 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 200 ms / 1,000 ms |
コード長 | 583 bytes |
コンパイル時間 | 3,549 ms |
コンパイル使用メモリ | 75,156 KB |
実行使用メモリ | 43,348 KB |
最終ジャッジ日時 | 2024-06-28 10:52:19 |
合計ジャッジ時間 | 5,379 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
import java.util.ArrayList; import java.util.Scanner; public class Wahu { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = Integer.parseInt(s.nextLine()); ArrayList<Integer> list = new ArrayList<>(); for(int i=0;i<N;i++){ int a = s.nextInt(); int b = s.nextInt(); list.add(b-a); } int buff = list.get(0); if(buff <= 0){ System.out.println(-1); return; } for(int i=1;i<list.size();i++){ if(buff != list.get(i)){ System.out.println(-1); return; } } System.out.println(buff); return; } }