結果
問題 |
No.185 和風
|
ユーザー |
![]() |
提出日時 | 2015-04-23 17:54:13 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 847 bytes |
コンパイル時間 | 1,903 ms |
コンパイル使用メモリ | 74,684 KB |
実行使用メモリ | 56,640 KB |
最終ジャッジ日時 | 2024-07-05 00:30:47 |
合計ジャッジ時間 | 3,657 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 2 |
ソースコード
import java.util.Scanner; public class Main { private final static Main main = new Main(); public static void main(String[] args) { long l = System.currentTimeMillis(); main.solve(); //System.out.println("処理時間:" + (System.currentTimeMillis() - l)); } private void solve() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ans = (sc.nextInt()-sc.nextInt())*-1; boolean flag = false; for(int i=1; i<n; ++i) { int x = sc.nextInt(); int y = sc.nextInt(); if(ans + x == y) { flag = true; } else { flag = false; break; } } System.out.println(flag ? ans : -1); } }