結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
samplelpmas
|
| 提出日時 | 2017-01-26 11:15:53 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 700 bytes |
| コンパイル時間 | 4,276 ms |
| コンパイル使用メモリ | 74,588 KB |
| 実行使用メモリ | 58,108 KB |
| 最終ジャッジ日時 | 2024-11-07 07:00:41 |
| 合計ジャッジ時間 | 21,178 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 21 WA * 8 |
ソースコード
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int ducks = sc.nextInt();
int[] x = new int[ducks];
for (int i = 0; i < ducks; i++) {
x[i] = sc.nextInt();
}
Arrays.sort(x);
int diff = x[1] - x[0];
if (diff == 0) {
System.out.println("NO");
return;
}
for (int i = 1; i < ducks - 1; i++) {
if (x[i] - x[i + 1] != diff) {
System.out.println("NO");
return;
}
}
System.out.println("YES");
}
}
samplelpmas