結果
| 問題 | No.123 カードシャッフル |
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2018-09-21 19:18:10 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 5,000 ms |
| コード長 | 649 bytes |
| コンパイル時間 | 889 ms |
| コンパイル使用メモリ | 110,896 KB |
| 実行使用メモリ | 31,860 KB |
| 最終ジャッジ日時 | 2024-07-18 08:45:22 |
| 合計ジャッジ時間 | 1,937 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.Linq;
using System.Collections.Generic;
using System;
public class Hello
{
public static void Main()
{
string[] line = Console.ReadLine().Trim().Split(' ');
var n = int.Parse(line[0]);
var m = int.Parse(line[1]);
line = Console.ReadLine().Trim().Split(' ');
var a = Array.ConvertAll(line, int.Parse);
var c = new List<int>(n);
foreach (var x in Enumerable.Range(1, n)) c.Add(x);
for (int i = 0; i < m; i++)
{
var w = c[a[i] - 1];
c.RemoveAt(a[i] - 1);
c.Insert(0, w);
}
Console.WriteLine(c[0]);
}
}
bluemegane