結果
| 問題 |
No.123 カードシャッフル
|
| ユーザー |
HKDnet
|
| 提出日時 | 2015-01-12 00:14:04 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 322 bytes |
| コンパイル時間 | 109 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 18,816 KB |
| 最終ジャッジ日時 | 2024-06-22 04:10:20 |
| 合計ジャッジ時間 | 2,294 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 6 WA * 4 |
コンパイルメッセージ
Main.rb:3: warning: `-' after local variable or literal is interpreted as binary operator Main.rb:3: warning: even though it seems like unary operator Main.rb:11: warning: mismatched indentations at 'elsif' with 'if' at 9 Main.rb:13: warning: mismatched indentations at 'else' with 'if' at 9 Main.rb:16: warning: mismatched indentations at 'end' with 'else' at 8 Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n,m = gets.chomp.split.map{|str| str.to_i}
shuffles = gets.chomp.split.map{|str| str.to_i}
target = shuffles[m -1]
(m - 2).downto(0) {|idx|
tmp = shuffles[idx]
if target == 1
target = tmp
else
if tmp < target
next
elsif tmp > target
target -= 1
else
target = 1
end
end
}
puts target
HKDnet