結果

問題 No.135 とりあえず1次元の問題
ユーザー takuktakuk
提出日時 2015-01-26 11:08:36
言語 Ruby
(3.3.0)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 192 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 11,296 KB
実行使用メモリ 26,688 KB
最終ジャッジ日時 2023-08-31 01:28:56
合計ジャッジ時間 3,447 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
26,688 KB
testcase_01 AC 69 ms
15,180 KB
testcase_02 AC 70 ms
15,088 KB
testcase_03 AC 68 ms
15,168 KB
testcase_04 AC 68 ms
15,064 KB
testcase_05 AC 69 ms
15,040 KB
testcase_06 AC 68 ms
15,260 KB
testcase_07 AC 69 ms
15,268 KB
testcase_08 AC 70 ms
15,168 KB
testcase_09 AC 69 ms
15,160 KB
testcase_10 AC 69 ms
15,304 KB
testcase_11 AC 66 ms
15,104 KB
testcase_12 AC 68 ms
15,264 KB
testcase_13 AC 69 ms
15,172 KB
testcase_14 AC 68 ms
15,160 KB
testcase_15 AC 69 ms
15,188 KB
testcase_16 AC 70 ms
15,260 KB
testcase_17 AC 71 ms
15,060 KB
testcase_18 AC 69 ms
15,292 KB
testcase_19 AC 68 ms
15,088 KB
testcase_20 AC 71 ms
15,176 KB
testcase_21 AC 113 ms
24,288 KB
testcase_22 AC 135 ms
26,500 KB
evil01.txt AC 130 ms
26,424 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n = gets.to_i
x = gets.split.map(&:to_i).sort.uniq
min = Float::INFINITY
0.upto(x.size - 2) do |i|
    min = x[i + 1] - x[i] if x[i + 1] - x[i] < min
end
puts min == Float::INFINITY ? 0 : min
0