結果
| 問題 |
No.26 シャッフルゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-29 14:49:07 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 5,000 ms |
| コード長 | 636 bytes |
| コンパイル時間 | 3,167 ms |
| コンパイル使用メモリ | 107,776 KB |
| 実行使用メモリ | 19,456 KB |
| 最終ジャッジ日時 | 2024-11-28 14:48:19 |
| 合計ジャッジ時間 | 4,089 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
class Program
{
static void Main()
{
bool[] cup = new bool[3];
cup[int.Parse(Console.ReadLine()) - 1] = true;
int n = int.Parse(Console.ReadLine());
for(int i = 0; i < n; i++)
{
int[] change = Console.ReadLine().Split().Select(a => int.Parse(a) - 1).ToArray();
bool temp = cup[change[0]];
cup[change[0]] = cup[change[1]];
cup[change[1]] = temp;
}
Console.WriteLine($"{cup.Select((a, i) => new {Content = a, Index = i}).Where(a => a.Content).Select(a => a.Index + 1).ToArray()[0]}");
}
}