結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
_k_a_n_i_
|
| 提出日時 | 2015-04-23 18:03:57 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 202 ms / 1,000 ms |
| コード長 | 858 bytes |
| コンパイル時間 | 2,315 ms |
| コンパイル使用メモリ | 74,248 KB |
| 実行使用メモリ | 56,804 KB |
| 最終ジャッジ日時 | 2024-07-05 00:30:53 |
| 合計ジャッジ時間 | 4,148 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
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 > 0 ? ans : -1);
}
}
_k_a_n_i_