結果

問題 No.26 シャッフルゲーム
ユーザー n.yn.y
提出日時 2022-06-08 14:25:45
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,616 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 107,224 KB
実行使用メモリ 24,164 KB
最終ジャッジ日時 2023-10-21 04:02:37
合計ジャッジ時間 1,802 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,132 KB
testcase_01 AC 25 ms
24,132 KB
testcase_02 WA -
testcase_03 AC 26 ms
24,132 KB
testcase_04 AC 26 ms
24,132 KB
testcase_05 WA -
testcase_06 AC 26 ms
24,132 KB
testcase_07 AC 25 ms
24,132 KB
testcase_08 AC 26 ms
24,132 KB
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;
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[3];
            //入れ替える回数分ループ
            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]);
                    
                }

                //入れ替え
                for(int j=0;j<3;j++)
                {
                    //a配列にn配列と同じ数字があれば
                    if (a[0] == n[j])
                    {
                        //入れ替える
                        n[j] = a[1];
                        continue;

                    }
                    if(a[1]==n[j])
                    {
                        n[j] = a[0];
                    }

                }

            }
            //現在印が付いたカップの位置
            for(int i=1;i<=3;i++)
            {
                if(N==n[i-1])
                {
                    Console.WriteLine(i);

                }
            }
        }
    }
}
0