結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
|
提出日時 | 2019-04-30 13:54:50 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 175 ms / 5,000 ms |
コード長 | 232 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 20,096 KB |
最終ジャッジ日時 | 2024-12-29 22:25:14 |
合計ジャッジ時間 | 4,403 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
コンパイルメッセージ
Syntax OK
ソースコード
n = gets.to_i xs = gets.split.map(&:to_i).sort ans = 10 ** 20 if n == 1 ans = 0 else (0...n-1).each do |i| next if xs[i] == xs[i+1] ans = [(xs[i]-xs[i+1]).abs, ans].min end end if ans == 10 ** 20 ans = 0 end puts ans