結果

問題 No.123 カードシャッフル
ユーザー yukirinyukirin
提出日時 2015-05-10 23:45:10
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 455 bytes
コンパイル時間 10,728 ms
コンパイル使用メモリ 239,764 KB
実行使用メモリ 8,716 KB
最終ジャッジ日時 2024-04-18 10:52:31
合計ジャッジ時間 12,775 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
)

func main() {
	var n, m, j int
	cards := make([]int, 0, 50)
	shuffle := make([]int, 0, 500)

	fmt.Scanln(&n, &m)

	for i := 1; i <= n; i++ {
		cards = append(cards, i)
	}

	for i := 0; i < m; i++ {
		fmt.Scanf("%d", &j)
		shuffle = append(shuffle, j-1)
	}

	fmt.Println(shuffle)
	for _, v := range shuffle {
		tmp := append([]int{cards[v]}, cards[:v]...)
		cards = append(tmp, cards[v+1:]...)
	}

	fmt.Println(cards[0])
}
0