結果

問題 No.406 鴨等間隔の法則
ユーザー basie23basie23
提出日時 2016-11-24 08:26:59
言語 Ruby
(3.3.0)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 188 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 11,264 KB
実行使用メモリ 23,616 KB
最終ジャッジ日時 2023-09-21 18:18:54
合計ジャッジ時間 5,335 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
18,124 KB
testcase_01 AC 76 ms
15,296 KB
testcase_02 AC 76 ms
15,152 KB
testcase_03 AC 77 ms
15,084 KB
testcase_04 AC 125 ms
22,424 KB
testcase_05 AC 96 ms
17,596 KB
testcase_06 AC 96 ms
17,944 KB
testcase_07 AC 98 ms
17,964 KB
testcase_08 AC 124 ms
22,544 KB
testcase_09 AC 136 ms
23,472 KB
testcase_10 AC 100 ms
18,288 KB
testcase_11 AC 118 ms
21,428 KB
testcase_12 AC 105 ms
19,340 KB
testcase_13 AC 102 ms
19,012 KB
testcase_14 AC 127 ms
21,712 KB
testcase_15 AC 78 ms
15,392 KB
testcase_16 AC 80 ms
15,508 KB
testcase_17 AC 78 ms
15,384 KB
testcase_18 AC 79 ms
15,392 KB
testcase_19 AC 81 ms
15,552 KB
testcase_20 AC 84 ms
15,832 KB
testcase_21 AC 82 ms
15,756 KB
testcase_22 AC 87 ms
16,820 KB
testcase_23 AC 105 ms
19,500 KB
testcase_24 AC 121 ms
21,020 KB
testcase_25 AC 136 ms
23,616 KB
testcase_26 AC 144 ms
23,564 KB
testcase_27 AC 126 ms
23,352 KB
testcase_28 AC 126 ms
23,504 KB
testcase_29 AC 145 ms
23,472 KB
testcase_30 AC 144 ms
23,160 KB
testcase_31 AC 135 ms
23,132 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
x = gets.split.map(&:to_i).sort

d = x[1] - x[0]
if d == 0
  puts 'NO'
  exit 0
end

2.upto(n-1) do |i|
  if(x[i] - x[i-1]) != d
    puts 'NO'
    exit 0
  end
end
puts 'YES'
0