結果

問題 No.123 カードシャッフル
ユーザー fmhrfmhr
提出日時 2015-04-27 05:40:47
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 12,098 ms
コンパイル使用メモリ 241,816 KB
実行使用メモリ 8,208 KB
最終ジャッジ日時 2024-04-18 10:44:15
合計ジャッジ時間 11,436 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

import (
    "fmt"
)

func pop(a []int, x int) ([]int, int){
    x = a[x]
    a = append(a[:x], a[x+1:]...)
    return a, x
}
func main() {
    var N, M int
    fmt.Scan(&N, &M)
    s := make([]int, N)
    for i:=0; i<N; i++ {
        s[i] = i
    }
//    fmt.Println(s)
    var a int
    for i:=0; i<M; i++ {
        fmt.Scan(&a)
        a -= 1
        s, a = pop(s, a)
        tmp_slice := []int {a}
        s = append(tmp_slice, s[:]...)
//        fmt.Println(s)
    }
    fmt.Println(s[0]+1)
}
0