結果
問題 | No.123 カードシャッフル |
ユーザー |
|
提出日時 | 2017-10-16 17:52:10 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 67 ms / 5,000 ms |
コード長 | 638 bytes |
コンパイル時間 | 4,394 ms |
コンパイル使用メモリ | 106,240 KB |
実行使用メモリ | 25,240 KB |
最終ジャッジ日時 | 2024-11-17 20:57:37 |
合計ジャッジ時間 | 3,072 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; using System.Collections.Generic; public class yukicoder { public static void Main() { int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); int[] shufflenum = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); List<int> cards = new List<int>(); for(int i = 0; i <= input[0] - 1; i++) { cards.Add(i + 1); } for(int i = 0; i <= input[1] - 1; i++) { int n = shufflenum[i] - 1; if(n != 0) { int temp = cards[n];; cards.Remove(temp); cards.Insert(0, temp); } } Console.WriteLine(cards[0]); } }