結果

問題 No.123 カードシャッフル
ユーザー simansiman
提出日時 2015-01-13 01:55:42
言語 Ruby
(3.3.0)
結果
AC  
実行時間 139 ms / 5,000 ms
コード長 269 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 11,180 KB
実行使用メモリ 21,612 KB
最終ジャッジ日時 2023-09-04 05:07:47
合計ジャッジ時間 2,968 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,032 KB
testcase_01 AC 81 ms
15,084 KB
testcase_02 AC 81 ms
15,172 KB
testcase_03 AC 81 ms
15,300 KB
testcase_04 AC 81 ms
15,104 KB
testcase_05 AC 81 ms
15,128 KB
testcase_06 AC 81 ms
15,176 KB
testcase_07 AC 81 ms
15,272 KB
testcase_08 AC 81 ms
15,196 KB
testcase_09 AC 81 ms
14,992 KB
testcase_10 AC 135 ms
21,280 KB
testcase_11 AC 137 ms
21,612 KB
testcase_12 AC 139 ms
21,540 KB
testcase_13 AC 139 ms
21,532 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - m
Syntax OK

ソースコード

diff #

class A
  def initialize
    n, m = gets.chomp.split(' ').map(&:to_i)
    shaffle = gets.chomp.split(' ').map(&:to_i)
    cards = [*(1..n)]

    shaffle.each do |i|
      num = cards.delete_at(i-1)
      cards.unshift(num)
    end

    puts cards.first
  end
end

A.new
0