結果

問題 No.123 カードシャッフル
ユーザー しらゆきしらゆき
提出日時 2015-11-22 23:09:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 102 ms / 5,000 ms
コード長 624 bytes
コンパイル時間 2,211 ms
コンパイル使用メモリ 98,128 KB
実行使用メモリ 26,780 KB
最終ジャッジ日時 2023-10-11 18:16:03
合計ジャッジ時間 4,133 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
21,820 KB
testcase_01 AC 59 ms
23,756 KB
testcase_02 AC 59 ms
21,760 KB
testcase_03 AC 61 ms
21,784 KB
testcase_04 AC 59 ms
23,836 KB
testcase_05 AC 60 ms
21,784 KB
testcase_06 AC 60 ms
21,664 KB
testcase_07 AC 60 ms
21,780 KB
testcase_08 AC 59 ms
21,796 KB
testcase_09 AC 60 ms
19,664 KB
testcase_10 AC 89 ms
26,312 KB
testcase_11 AC 102 ms
26,780 KB
testcase_12 AC 96 ms
24,708 KB
testcase_13 AC 97 ms
24,776 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.Linq;

class Program
{
    static void Main()
    {
        var tmp = Console.ReadLine().Split();
        int n = int.Parse(tmp[0]);
        int m = int.Parse(tmp[1]);
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var num = new int[n];
        for (int i = 0; i < n; i++) num[i] = i + 1; 

        for (int i = 0; i < m; i++)
        {
            int tm = num[a[i] - 1];
            for (int j = a[i] - 1; j > 0; j--)
            {
                num[j] = num[j - 1];
            }
            num[0] = tm;
        }

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