結果
問題 | No.123 カードシャッフル |
ユーザー |
|
提出日時 | 2017-07-16 23:10:57 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 446 ms / 5,000 ms |
コード長 | 682 bytes |
コンパイル時間 | 12,386 ms |
コンパイル使用メモリ | 214,916 KB |
実行使用メモリ | 6,528 KB |
最終ジャッジ日時 | 2024-10-08 04:34:59 |
合計ジャッジ時間 | 14,797 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
package mainimport ("fmt")func main() {var sum, shf intfmt.Scan(&sum, &shf)cards := make([]int, sum)for i:=0; i<sum; i++ {cards[i] = 1 + i}for i:=0; i<shf; i++ {var whr int // 上から何番目かfmt.Scan(&whr)top := []int{cards[whr - 1]}//fmt.Println(top)cards = remove(cards, cards[whr-1])cards = append(top, cards...)}fmt.Println(cards[0])}func remove(cards []int, card int) []int {result := []int{}for _, num := range cards {if num != card {result = append(result, num)}}//fmt.Println(result)return result}