結果

問題 No.123 カードシャッフル
ユーザー yukirin
提出日時 2015-05-10 23:36:07
言語 Go
(1.23.4)
結果
RE  
実行時間 -
コード長 492 bytes
コンパイル時間 10,789 ms
コンパイル使用メモリ 223,976 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-10 04:05:28
合計ジャッジ時間 11,633 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6 RE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var n, m int
	var s string
	cards := make([]int, 0, 50)

	fmt.Scanln(&n, &m)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	s = scanner.Text()

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

	for _, v := range strings.Split(s, " ") {
		i, _ := strconv.Atoi(v)
		j := i - 1
		tmp := append([]int{cards[j]}, cards[:j]...)
		cards = append(tmp, cards[j+1:]...)
	}

	fmt.Println(cards[0])
}
0