結果

問題 No.123 カードシャッフル
ユーザー mencottonmencotton
提出日時 2017-12-31 22:26:42
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 848 ms / 5,000 ms
コード長 815 bytes
コンパイル時間 2,132 ms
コンパイル使用メモリ 104,668 KB
実行使用メモリ 35,464 KB
最終ジャッジ日時 2023-08-23 12:36:38
合計ジャッジ時間 5,544 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
25,208 KB
testcase_01 AC 62 ms
23,060 KB
testcase_02 AC 63 ms
22,916 KB
testcase_03 AC 64 ms
25,212 KB
testcase_04 AC 62 ms
23,204 KB
testcase_05 AC 63 ms
23,128 KB
testcase_06 AC 62 ms
21,156 KB
testcase_07 AC 63 ms
25,196 KB
testcase_08 AC 63 ms
25,036 KB
testcase_09 AC 63 ms
25,120 KB
testcase_10 AC 102 ms
32,300 KB
testcase_11 AC 848 ms
35,464 KB
testcase_12 AC 372 ms
35,304 KB
testcase_13 AC 374 ms
35,236 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;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            LinkedList<int> card = new LinkedList<int>();
            for (int i = 1; i <= x[0]; i++) card.AddLast(i);
            for (int i = 0; i < x[1]; i++)
            {
                int n = card.First.Value;
                for (int j = 0; j < a[i] - 1; j++)
                {
                    n = card.Find(n).Next.Value;
                }
                card.Remove(n);
                card.AddFirst(n);
            }
            Console.WriteLine(card.First.Value);
        }
    }
}
0