結果
| 問題 |
No.406 鴨等間隔の法則
|
| ユーザー |
samplelpmas
|
| 提出日時 | 2017-01-26 11:26:58 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 642 ms / 2,000 ms |
| コード長 | 696 bytes |
| コンパイル時間 | 1,994 ms |
| コンパイル使用メモリ | 75,044 KB |
| 実行使用メモリ | 61,952 KB |
| 最終ジャッジ日時 | 2024-07-07 12:08:25 |
| 合計ジャッジ時間 | 17,509 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
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; i++) {
if (x[i] - x[i - 1] != diff) {
System.out.println("NO");
return;
}
}
System.out.println("YES");
}
}
samplelpmas