結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
|
提出日時 | 2015-08-13 05:36:39 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 211 ms / 5,000 ms |
コード長 | 221 bytes |
コンパイル時間 | 138 ms |
コンパイル使用メモリ | 7,936 KB |
実行使用メモリ | 23,080 KB |
最終ジャッジ日時 | 2025-01-03 07:25:57 |
合計ジャッジ時間 | 3,822 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - num Syntax OK
ソースコード
num = gets.chomp.to_i arr = gets.chomp.split.sort.map(&:to_i) ans = [] for i in 1...arr.length ans.push (arr[i] - arr[i-1]).abs unless arr[i] - arr[i-1] == 0 end ans.push 0 if ans.length == 0 ans = ans.sort puts ans[0]