結果

問題 No.406 鴨等間隔の法則
ユーザー jiro8719jiro8719
提出日時 2018-07-10 18:19:18
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 298 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 11,228 KB
実行使用メモリ 23,884 KB
最終ジャッジ日時 2023-10-11 14:39:18
合計ジャッジ時間 6,481 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
18,360 KB
testcase_01 RE -
testcase_02 AC 84 ms
15,256 KB
testcase_03 AC 83 ms
15,124 KB
testcase_04 AC 135 ms
22,500 KB
testcase_05 AC 103 ms
17,716 KB
testcase_06 AC 103 ms
17,776 KB
testcase_07 AC 105 ms
18,096 KB
testcase_08 AC 129 ms
22,416 KB
testcase_09 AC 143 ms
23,416 KB
testcase_10 AC 103 ms
18,200 KB
testcase_11 AC 125 ms
21,468 KB
testcase_12 AC 112 ms
19,144 KB
testcase_13 AC 110 ms
18,900 KB
testcase_14 RE -
testcase_15 AC 85 ms
15,364 KB
testcase_16 AC 86 ms
15,348 KB
testcase_17 AC 85 ms
15,288 KB
testcase_18 AC 85 ms
15,296 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 89 ms
15,992 KB
testcase_22 RE -
testcase_23 AC 114 ms
19,712 KB
testcase_24 RE -
testcase_25 AC 145 ms
23,452 KB
testcase_26 RE -
testcase_27 AC 132 ms
23,496 KB
testcase_28 AC 131 ms
23,720 KB
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 144 ms
23,136 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

num = gets.to_i
list = gets.split(" ").map(&:to_i).sort
a = list[0] - list[1]
for i in 0..num-1
    if list[i] == list[i+1]
        puts "NO"
        break
    end
    if list[i] - list[i+1] != a
        puts "NO"
        break
    end
    if i == num-1
        puts "YES"
        break
    end
end
0