結果

問題 No.26 シャッフルゲーム
ユーザー bluemeganebluemegane
提出日時 2018-10-24 17:01:45
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 719 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 102,124 KB
実行使用メモリ 22,744 KB
最終ジャッジ日時 2023-08-12 06:54:54
合計ジャッジ時間 3,566 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
20,772 KB
testcase_01 AC 56 ms
20,656 KB
testcase_02 AC 55 ms
18,560 KB
testcase_03 AC 56 ms
22,624 KB
testcase_04 AC 57 ms
22,744 KB
testcase_05 AC 56 ms
20,728 KB
testcase_06 AC 56 ms
18,672 KB
testcase_07 AC 57 ms
20,624 KB
testcase_08 AC 58 ms
20,828 KB
testcase_09 AC 58 ms
20,648 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    public static void Main()
    {
        var a = new int[3];
        a[0] = 0; a[1] = 1; a[2] = 2;
        var t = int.Parse(Console.ReadLine().Trim()) - 1;
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var p = int.Parse(line[0]) - 1;
            var q = int.Parse(line[1]) - 1;
            swap(a, p, q);
        }
        for (int i = 0; i < 3; i++)
            if (a[i] == t) { Console.WriteLine(i + 1); break; }
    }
    public static void swap(int[] a, int p, int q)
    {
        var w = a[p];
        a[p] = a[q];
        a[q] = w;
    }
}
0