結果

問題 No.406 鴨等間隔の法則
ユーザー finefine
提出日時 2016-08-05 22:29:59
言語 Ruby
(3.3.0)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 261 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 11,240 KB
実行使用メモリ 26,788 KB
最終ジャッジ日時 2023-09-21 17:42:19
合計ジャッジ時間 5,611 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
19,560 KB
testcase_01 AC 84 ms
15,132 KB
testcase_02 AC 89 ms
15,024 KB
testcase_03 AC 83 ms
15,152 KB
testcase_04 AC 142 ms
25,444 KB
testcase_05 AC 107 ms
18,908 KB
testcase_06 AC 111 ms
19,084 KB
testcase_07 AC 110 ms
19,292 KB
testcase_08 AC 140 ms
25,156 KB
testcase_09 AC 156 ms
26,764 KB
testcase_10 AC 110 ms
19,568 KB
testcase_11 AC 134 ms
23,884 KB
testcase_12 AC 120 ms
20,680 KB
testcase_13 AC 115 ms
20,316 KB
testcase_14 AC 142 ms
24,468 KB
testcase_15 AC 87 ms
15,548 KB
testcase_16 AC 88 ms
15,684 KB
testcase_17 AC 87 ms
15,420 KB
testcase_18 AC 89 ms
15,820 KB
testcase_19 AC 93 ms
15,844 KB
testcase_20 AC 92 ms
16,264 KB
testcase_21 AC 91 ms
16,052 KB
testcase_22 AC 97 ms
17,400 KB
testcase_23 AC 118 ms
21,080 KB
testcase_24 AC 139 ms
23,588 KB
testcase_25 AC 155 ms
26,788 KB
testcase_26 AC 163 ms
26,716 KB
testcase_27 AC 138 ms
24,296 KB
testcase_28 AC 145 ms
26,652 KB
testcase_29 AC 162 ms
26,632 KB
testcase_30 AC 163 ms
26,768 KB
testcase_31 AC 151 ms
26,444 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
x = gets.split.map(&:to_i).sort
if x.uniq.size != x.size
    puts "NO"
else
    d = x[1] - x[0]
    a = x[1]
    2.upto(n - 1) {|i|
        a += d
        if x[i] != a
            puts "NO"
            exit
        end
        }
    puts "YES"
end
0