結果
| 問題 |
No.123 カードシャッフル
|
| コンテスト | |
| ユーザー |
アソビダマ
|
| 提出日時 | 2025-02-21 02:17:34 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 93 ms / 5,000 ms |
| コード長 | 889 bytes |
| コンパイル時間 | 19,760 ms |
| コンパイル使用メモリ | 171,136 KB |
| 実行使用メモリ | 197,468 KB |
| 最終ジャッジ日時 | 2025-02-21 02:17:57 |
| 合計ジャッジ時間 | 21,784 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 10 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (116 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
using System.Collections.Generic;
public class Program
{
static void Main()
{
string s = Console.ReadLine();
string[] t = s.Split(' ');
// カード枚数
int N = Int32.Parse(t[0]);
// 全カード情報生成
List<int> cardList = new List<int>();
for(int i = 0; i < N; i++)cardList.Add(i+1);
// シャッフル情報取得
s = Console.ReadLine();
string[] shArrayString = s.Split(' ');
// シャッフル実行
int shIndex;
int shOldValue;
for(int i = 0; i < shArrayString.Length; i++)
{
shIndex = Int32.Parse(shArrayString[i]) - 1;
shOldValue = cardList[shIndex];
cardList.RemoveAt(shIndex);
cardList.Insert(0,shOldValue);
}
Console.WriteLine($"{cardList[0]}");
}
}
アソビダマ