結果
問題 | No.185 和風 |
ユーザー |
![]() |
提出日時 | 2017-06-22 15:43:02 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 208 ms / 1,000 ms |
コード長 | 450 bytes |
コンパイル時間 | 2,015 ms |
コンパイル使用メモリ | 77,132 KB |
実行使用メモリ | 56,820 KB |
最終ジャッジ日時 | 2024-10-02 12:17:41 |
合計ジャッジ時間 | 3,907 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int x0 = sc.nextInt(); int y0 = sc.nextInt(); int ans = y0 - x0; for(int i = 1; i < N; i++) { int x = sc.nextInt(); int y = sc.nextInt(); if(ans != y - x) { ans = -1; break; } } if(ans <= 0) ans = -1; System.out.println(ans); } }