結果
問題 | No.123 カードシャッフル |
ユーザー |
|
提出日時 | 2017-08-10 00:28:14 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 72 ms / 5,000 ms |
コード長 | 638 bytes |
コンパイル時間 | 847 ms |
コンパイル使用メモリ | 111,976 KB |
実行使用メモリ | 30,176 KB |
最終ジャッジ日時 | 2024-10-12 00:29:56 |
合計ジャッジ時間 | 2,059 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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;class Program {static void Main() {string[] l0 = Console.ReadLine().Split(' ');int n = int.Parse(l0[0]);int m = int.Parse(l0[1]);List<int> card = new List<int>();for (int i = 1; i <= n; i++) {card.Add(i);}List<int> a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();for (int j = 0; j < m; j++) {int tmp = card[a[j] - 1];card.RemoveAt(a[j] - 1);card.Insert(0, tmp);}Console.WriteLine(card[0]);}}