結果

問題 No.406 鴨等間隔の法則
ユーザー suppy193suppy193
提出日時 2016-08-24 11:13:47
言語 Ruby
(3.3.0)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 203 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 11,328 KB
実行使用メモリ 22,736 KB
最終ジャッジ日時 2023-09-21 18:03:05
合計ジャッジ時間 6,049 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
18,068 KB
testcase_01 AC 82 ms
15,040 KB
testcase_02 AC 82 ms
15,208 KB
testcase_03 AC 82 ms
15,224 KB
testcase_04 AC 134 ms
21,600 KB
testcase_05 AC 104 ms
17,532 KB
testcase_06 AC 105 ms
17,508 KB
testcase_07 AC 105 ms
17,676 KB
testcase_08 AC 131 ms
21,624 KB
testcase_09 AC 137 ms
22,560 KB
testcase_10 AC 100 ms
18,096 KB
testcase_11 AC 118 ms
20,680 KB
testcase_12 AC 105 ms
19,012 KB
testcase_13 AC 102 ms
18,608 KB
testcase_14 AC 128 ms
21,140 KB
testcase_15 AC 80 ms
15,412 KB
testcase_16 AC 80 ms
15,572 KB
testcase_17 AC 80 ms
15,104 KB
testcase_18 AC 81 ms
15,420 KB
testcase_19 AC 83 ms
15,388 KB
testcase_20 AC 84 ms
15,740 KB
testcase_21 AC 82 ms
15,812 KB
testcase_22 AC 90 ms
16,636 KB
testcase_23 AC 106 ms
19,076 KB
testcase_24 AC 122 ms
20,596 KB
testcase_25 AC 137 ms
22,736 KB
testcase_26 AC 143 ms
22,660 KB
testcase_27 AC 123 ms
22,476 KB
testcase_28 AC 129 ms
22,672 KB
testcase_29 AC 145 ms
22,652 KB
testcase_30 AC 144 ms
22,668 KB
testcase_31 AC 134 ms
22,176 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
pos = gets.split(' ').map(&:to_i).sort!
diff = pos[1] - pos[0]
if diff == 0
	puts "NO"
	exit
end
(1...n-1).each do |i|
	if pos[i + 1] - pos[i] != diff
		puts "NO"
		exit
	end
end
puts "YES"
0