結果

問題 No.123 カードシャッフル
ユーザー 小指が強い人小指が強い人
提出日時 2015-11-11 01:55:45
言語 Ruby
(3.3.0)
結果
AC  
実行時間 378 ms / 5,000 ms
コード長 276 bytes
コンパイル時間 53 ms
コンパイル使用メモリ 11,568 KB
実行使用メモリ 21,496 KB
最終ジャッジ日時 2023-10-11 15:35:26
合計ジャッジ時間 2,985 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
15,312 KB
testcase_01 AC 83 ms
15,268 KB
testcase_02 AC 84 ms
15,268 KB
testcase_03 AC 84 ms
15,120 KB
testcase_04 AC 83 ms
15,296 KB
testcase_05 AC 87 ms
15,092 KB
testcase_06 AC 83 ms
15,224 KB
testcase_07 AC 84 ms
15,048 KB
testcase_08 AC 85 ms
15,104 KB
testcase_09 AC 84 ms
15,264 KB
testcase_10 AC 136 ms
21,400 KB
testcase_11 AC 378 ms
21,380 KB
testcase_12 AC 255 ms
21,280 KB
testcase_13 AC 255 ms
21,496 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

nm = gets.split
n = nm[0].to_i
m = nm[1].to_i
a = gets.split.map(&:to_i)
s = Array.new(n)
n.times do |i|
    s[i] = i + 1
end
m.times do |i|
    ai = a[i] - 1
    t = s[ai]
    j = ai
    while j > 0 do
        s[j] = s[j - 1]
        j -= 1
    end
    s[0] = t
end
puts s[0]
0