結果

問題 No.123 カードシャッフル
ユーザー iwamotiwamot
提出日時 2016-01-24 23:16:59
言語 Ruby
(3.3.0)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 185 bytes
コンパイル時間 51 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 22,268 KB
最終ジャッジ日時 2023-10-21 14:56:38
合計ジャッジ時間 1,877 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
16,088 KB
testcase_01 AC 70 ms
16,088 KB
testcase_02 AC 66 ms
16,088 KB
testcase_03 AC 65 ms
16,088 KB
testcase_04 AC 66 ms
16,088 KB
testcase_05 AC 66 ms
16,084 KB
testcase_06 AC 68 ms
16,088 KB
testcase_07 AC 67 ms
16,088 KB
testcase_08 AC 70 ms
16,088 KB
testcase_09 AC 66 ms
16,088 KB
testcase_10 AC 102 ms
22,172 KB
testcase_11 AC 111 ms
22,268 KB
testcase_12 AC 118 ms
22,252 KB
testcase_13 AC 114 ms
22,252 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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
end

puts cards[0]
0