結果

問題 No.123 カードシャッフル
ユーザー iwamotiwamot
提出日時 2016-01-24 23:16:34
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 195 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 11,888 KB
実行使用メモリ 25,308 KB
最終ジャッジ日時 2023-10-21 14:56:50
合計ジャッジ時間 5,949 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 70 ms
16,088 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 105 ms
22,176 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - m
Syntax OK

ソースコード

diff #

n, m = gets.split(' ').map(&:to_i)
a = gets.split(' ').map(&:to_i)

cards = (1..n).to_a
a.each do |i|
  next if i == 1
  c = cards.delete_at(i - 1)
  cards.unshift c
  p cards
end

puts cards[0]
0