結果

問題 No.135 とりあえず1次元の問題
ユーザー rky
提出日時 2017-11-07 00:04:12
言語 Ruby
(3.4.1)
結果
AC  
実行時間 165 ms / 5,000 ms
コード長 259 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 24,064 KB
最終ジャッジ日時 2024-11-24 04:11:08
合計ジャッジ時間 3,441 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - test_case
Syntax OK

ソースコード

diff #

test_case = gets.chomp.to_i
list = gets.chomp.split.map(&:to_i).uniq.sort!
distance = 1000000

for i in 0...list.length - 1 do
	distance = (list[i + 1] - list[i]).abs if distance > (list[i + 1] - list[i]).abs
end
distance = 0 if list.length == 1
puts distance
0