結果

問題 No.406 鴨等間隔の法則
ユーザー shi-mo
提出日時 2016-08-31 21:52:48
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 1,763 ms
コンパイル使用メモリ 144,232 KB
実行使用メモリ 7,076 KB
最終ジャッジ日時 2024-06-12 04:03:01
合計ジャッジ時間 4,338 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.conv;
import std.array;
import std.algorithm;

void main() {
    int n;
    readf("%s\n", &n);

    uint[] x = readln().split.map!(to!uint).array;
    sort(x);

    uint d = x[1] - x[0];
    if (0 == d) {
        writeln("NO");
        return;
    }

    foreach (i; 2..n) {
        if ((x[i] - x[i-1]) != d) {
            writeln("NO");
            return;
        }
    }
    writeln("YES");
}
0