結果
| 問題 |
No.123 カードシャッフル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-01 00:33:02 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 77 ms / 5,000 ms |
| コード長 | 681 bytes |
| コンパイル時間 | 908 ms |
| コンパイル使用メモリ | 108,756 KB |
| 実行使用メモリ | 32,276 KB |
| 最終ジャッジ日時 | 2024-12-18 00:42:21 |
| 合計ジャッジ時間 | 2,273 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.Linq;
using System.Collections.Generic;
public class Hello{
public static void Main(){
var n = Console.ReadLine().Split().Select(int.Parse).ToArray();
var cards = new List<int>();
for(int i=n[0];i>0;i--)
cards.Add(i);
n = Console.ReadLine().Split().Select(int.Parse).ToArray();
for(int i=0;i<n.Length;i++)
{
cards.Reverse();
int tmp=cards[n[i]-1];
cards.RemoveAt(n[i]-1);
cards.Reverse();
cards.Add(tmp);
}
Console.WriteLine(cards[cards.Count-1]);
}
}