結果

問題 No.123 カードシャッフル
ユーザー oreoreoresanoreoreoresan
提出日時 2018-03-29 13:22:09
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 108 ms / 5,000 ms
コード長 1,754 bytes
コンパイル時間 2,280 ms
コンパイル使用メモリ 100,896 KB
実行使用メモリ 27,800 KB
最終ジャッジ日時 2023-09-08 04:53:35
合計ジャッジ時間 4,210 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,916 KB
testcase_01 AC 57 ms
20,836 KB
testcase_02 AC 57 ms
22,892 KB
testcase_03 AC 57 ms
22,884 KB
testcase_04 AC 56 ms
20,848 KB
testcase_05 AC 57 ms
20,876 KB
testcase_06 AC 56 ms
20,816 KB
testcase_07 AC 57 ms
22,924 KB
testcase_08 AC 57 ms
21,032 KB
testcase_09 AC 58 ms
22,904 KB
testcase_10 AC 86 ms
27,800 KB
testcase_11 AC 108 ms
26,264 KB
testcase_12 AC 100 ms
26,288 KB
testcase_13 AC 98 ms
26,172 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;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            
            string s1 = Console.ReadLine();
            string[] t1 = s1.Split(' ');
            string s2 = Console.ReadLine();
            string[] t2 = s2.Split(' ');            

            /*
            string[] t1 = new string[2] { "3", "2"};
            string[] t2 = new string[2] { "3", "2"};
            */

            /*
            string[] t1 = new string[2] { "3", "1" };
            string[] t2 = new string[1] { "2" };
            */

            /*
            string[] t1 = new string[2] { "4", "4" };
            string[] t2 = new string[4] { "1", "1", "1", "1" };
            */


            int cardnum = int.Parse(t1[0]);
            int shufflenum = int.Parse(t1[1]);


            int[] stacknum = new int[100000];
            int[] datanum = new int[100000];

            for (int i = 0; i < shufflenum; i++)
            {
                stacknum[i] = int.Parse(t2[i]);
            }

            for (int i = 0; i < cardnum; i++)
            {
                datanum[i] = i + 1;
            }

            for (int i = 0; i < shufflenum; i++)
            {
                int kari = datanum[stacknum[i] - 1];
                int temp = datanum[0];
                int temp2 = 0;
                for (int j = 0; j < stacknum[i] - 1; j++, temp = temp2)
                {
                    temp2 = datanum[j + 1];
                    datanum[j + 1] = temp;
                }
                datanum[0] = kari;
            }

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