結果

問題 No.26 シャッフルゲーム
ユーザー n.yn.y
提出日時 2022-06-08 16:01:29
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,190 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 106,264 KB
実行使用メモリ 24,220 KB
最終ジャッジ日時 2023-10-21 04:06:59
合計ジャッジ時間 1,550 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
24,140 KB
testcase_01 AC 23 ms
24,140 KB
testcase_02 AC 22 ms
24,136 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 22 ms
24,136 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Diagnostics;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //カップ
            //int[] n = { 1, 2, 3 };
            //印が付いたカップの位置
            int N = int.Parse(Console.ReadLine());
            //カップを入れ替える回数
            int M = int.Parse(Console.ReadLine());

            int[] a = new int[2];
            int[] n = new int[3];

            //現在の印の位置
            int x = N;
            //入れ替える回数分ループ
            for (int i = 0; i < M; i++)
            {

                string[] str = Console.ReadLine().Split(' ');
                //入れ替える位置の番号
                for (int j = 0; j < 2; j++)
                {

                    int A = int.Parse(str[j]);
                    a[j] = A;
                    //Debug.WriteLine(a[j]);

                }

                //Nと入れ替える位置が同じなら
                if (N == a[0])
                {
                    //入れ替え
                    for (int j = 1; j <= 3; j++)
                    {
                        //a配列にn配列と同じ数字があれば
                        if (a[0] == j)
                        {
                            //入れ替える
                            //int temp = a[0];
                            x = a[1];
                            //a[1] = temp;
                            break;
                        }
                        //if (j == 2)
                        //{
                        //    Debug.Write(n[j]);
                        //}
                    }


                }
                else if(N==a[1])
                {
                    for(int j=1;j<=3;j++)
                    {

                        if (a[1] == j)
                        {
                            //int temp = a[1];
                            x = a[0];
                           // a[0] = temp;
                            break;
                        }

                    }
                }
            }
            Console.WriteLine(x);
        }
    }
}
0