結果

問題 No.26 シャッフルゲーム
ユーザー bluemeganebluemegane
提出日時 2018-10-24 16:54:26
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 717 bytes
コンパイル時間 889 ms
コンパイル使用メモリ 110,220 KB
実行使用メモリ 26,128 KB
最終ジャッジ日時 2024-04-29 21:25:02
合計ジャッジ時間 1,704 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
17,664 KB
testcase_01 AC 24 ms
17,536 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 25 ms
17,792 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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());
        string[] line = Console.ReadLine().Trim().Split(' ');
        for (int i = 0; i < n; i++)
        {
            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