結果
問題 | No.123 カードシャッフル |
ユーザー |
![]() |
提出日時 | 2017-12-31 22:26:42 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 943 ms / 5,000 ms |
コード長 | 815 bytes |
コンパイル時間 | 1,064 ms |
コンパイル使用メモリ | 105,216 KB |
実行使用メモリ | 30,976 KB |
最終ジャッジ日時 | 2024-12-21 15:36:44 |
合計ジャッジ時間 | 4,009 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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);}}}