結果

問題 No.135 とりあえず1次元の問題
ユーザー MaxMellonMaxMellon
提出日時 2015-08-13 05:33:22
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 216 bytes
コンパイル時間 42 ms
コンパイル使用メモリ 11,568 KB
実行使用メモリ 25,232 KB
最終ジャッジ日時 2023-09-01 21:29:59
合計ジャッジ時間 3,495 ms
ジャッジサーバーID
(参考情報)
judge16 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 160 ms
25,232 KB
testcase_01 AC 82 ms
15,296 KB
testcase_02 AC 82 ms
15,036 KB
testcase_03 AC 82 ms
15,160 KB
testcase_04 WA -
testcase_05 AC 83 ms
15,256 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 82 ms
15,124 KB
testcase_20 WA -
testcase_21 AC 134 ms
22,516 KB
testcase_22 AC 162 ms
25,168 KB
evil01.txt AC 156 ms
25,076 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - num
Syntax OK

ソースコード

diff #

num = gets.chomp.to_i
arr = gets.chomp.split.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]
0