結果
問題 |
No.1438 Broken Drawers
|
ユーザー |
|
提出日時 | 2021-04-04 05:17:38 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 364 bytes |
コンパイル時間 | 189 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 26,624 KB |
最終ジャッジ日時 | 2024-12-26 04:53:31 |
合計ジャッジ時間 | 5,842 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 4 WA * 21 |
コンパイルメッセージ
Main.rb:8: warning: `-' after local variable or literal is interpreted as binary operator Main.rb:8: warning: even though it seems like unary operator Main.rb:6: warning: assigned but unused variable - tmp Syntax OK
ソースコード
n = gets.chomp.to_i a = gets.chomp.split(" ").map(&:to_i) #この問題のpointは、最長の長さだけを答えれば良い。 #そのため、最長のものの例を示さなくても良い。 count = 0 tmp = [] i = 0 while i < n -1 #0.upto(n-2) do |i| if a[i] > a[i+1] i += 1 count += 1 else i += 1 end end puts n - count