結果

問題 No.123 カードシャッフル
ユーザー akichiakichi
提出日時 2017-08-10 00:28:14
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 71 ms / 5,000 ms
コード長 638 bytes
コンパイル時間 1,124 ms
コンパイル使用メモリ 105,728 KB
実行使用メモリ 25,164 KB
最終ジャッジ日時 2024-04-20 05:29:51
合計ジャッジ時間 2,696 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
19,072 KB
testcase_01 AC 26 ms
18,944 KB
testcase_02 AC 27 ms
19,072 KB
testcase_03 AC 27 ms
18,944 KB
testcase_04 AC 28 ms
18,944 KB
testcase_05 AC 27 ms
18,688 KB
testcase_06 AC 27 ms
19,072 KB
testcase_07 AC 26 ms
18,816 KB
testcase_08 AC 26 ms
19,200 KB
testcase_09 AC 27 ms
18,816 KB
testcase_10 AC 54 ms
23,936 KB
testcase_11 AC 63 ms
25,164 KB
testcase_12 AC 70 ms
24,820 KB
testcase_13 AC 71 ms
25,088 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
class Program {
    static void Main() {

        string[] l0 = Console.ReadLine().Split(' ');
        int n = int.Parse(l0[0]);
        int m = int.Parse(l0[1]);

        List<int> card = new List<int>();

        for (int i = 1; i <= n; i++) {
            card.Add(i);
        }

        List<int> a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        for (int j = 0; j < m; j++) {
            int tmp = card[a[j] - 1];
            card.RemoveAt(a[j] - 1);
            card.Insert(0, tmp);

        }
        Console.WriteLine(card[0]);
    }
}
0