結果
問題 | No.123 カードシャッフル |
ユーザー |
![]() |
提出日時 | 2018-03-03 01:11:45 |
言語 | Swift (6.0.3) |
結果 |
AC
|
実行時間 | 43 ms / 5,000 ms |
コード長 | 365 bytes |
コンパイル時間 | 1,186 ms |
コンパイル使用メモリ | 130,076 KB |
実行使用メモリ | 13,516 KB |
最終ジャッジ日時 | 2024-11-30 12:05:17 |
合計ジャッジ時間 | 2,194 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
let inpt = readLine()!.split(separator: " ").map{Int($0)!}let itemCount = inpt[0]let shuffCount = inpt[1]var cards = [Int]()for i in 1...itemCount {cards.append(i)}let shuffle = readLine()!.split(separator: " ").map{Int($0)! - 1}for sh in shuffle {let tmp = cards[sh]cards.remove(at: sh)cards.insert(tmp, at: 0)}print(cards.first!)