結果

問題 No.406 鴨等間隔の法則
ユーザー Lo_OTLo_OT
提出日時 2018-01-01 16:02:00
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 297 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 25,472 KB
最終ジャッジ日時 2024-04-25 03:19:57
合計ジャッジ時間 5,147 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
17,536 KB
testcase_01 WA -
testcase_02 AC 85 ms
12,160 KB
testcase_03 AC 83 ms
12,288 KB
testcase_04 AC 143 ms
24,064 KB
testcase_05 AC 113 ms
16,512 KB
testcase_06 AC 109 ms
16,640 KB
testcase_07 AC 108 ms
16,768 KB
testcase_08 AC 143 ms
23,808 KB
testcase_09 AC 151 ms
24,960 KB
testcase_10 AC 113 ms
17,664 KB
testcase_11 AC 141 ms
22,528 KB
testcase_12 AC 116 ms
18,688 KB
testcase_13 AC 115 ms
18,304 KB
testcase_14 WA -
testcase_15 AC 85 ms
12,416 KB
testcase_16 AC 90 ms
12,672 KB
testcase_17 AC 88 ms
12,288 KB
testcase_18 AC 87 ms
12,672 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 96 ms
13,440 KB
testcase_22 WA -
testcase_23 AC 116 ms
19,072 KB
testcase_24 WA -
testcase_25 AC 149 ms
25,344 KB
testcase_26 WA -
testcase_27 AC 134 ms
22,144 KB
testcase_28 AC 140 ms
25,088 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 148 ms
24,576 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
kamo = gets.chomp.split.map(&:to_i)
kamo = kamo.sort.reverse
diff = 0

if kamo.uniq.length != n
    puts "NO"
else
    diff = kamo[0] - kamo[1]
    for i in 1..n-2
        if diff != (kamo[i] - kamo[i+1])
            puts "NO"
            return
        end
    end
    puts "OK"
end
0