結果

問題 No.26 シャッフルゲーム
ユーザー うわばみうわばみ
提出日時 2020-04-29 14:49:07
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 65 ms / 5,000 ms
コード長 636 bytes
コンパイル時間 2,515 ms
コンパイル使用メモリ 63,780 KB
実行使用メモリ 24,120 KB
最終ジャッジ日時 2023-08-19 02:08:05
合計ジャッジ時間 3,948 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,896 KB
testcase_01 AC 64 ms
21,948 KB
testcase_02 AC 63 ms
22,104 KB
testcase_03 AC 63 ms
23,976 KB
testcase_04 AC 65 ms
21,980 KB
testcase_05 AC 63 ms
24,120 KB
testcase_06 AC 63 ms
22,044 KB
testcase_07 AC 60 ms
21,948 KB
testcase_08 AC 62 ms
21,968 KB
testcase_09 AC 61 ms
22,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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]}");
    }
}
0