結果
| 問題 | No.185 和風 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-09-27 09:02:48 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 114 ms / 1,000 ms |
| + 465µs | |
| コード長 | 552 bytes |
| 記録 | |
| コンパイル時間 | 3,665 ms |
| コンパイル使用メモリ | 85,496 KB |
| 実行使用メモリ | 49,516 KB |
| 最終ジャッジ日時 | 2026-09-23 10:15:44 |
| 合計ジャッジ時間 | 4,794 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
import java.util.Scanner;
public class No185 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] input = new int[N*2];
for (int i=0; i< N * 2; i++)
input[i] = sc.nextInt();
int dif = input[1] - input[0];
int count = 0;
if(dif <= 0)
System.out.println("-1");
else{
for(int i=0; i < N * 2; i = i + 2){
if(input[i] + dif == input[i+1])
count++;
}
if(count ==N )
System.out.println(dif);
else
System.out.println("-1");
sc.close();
}
}
}