結果

問題 No.26 シャッフルゲーム
ユーザー k-a-rgbk-a-rgb
提出日時 2023-10-13 14:38:47
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 5,000 ms
コード長 949 bytes
コンパイル時間 2,160 ms
コンパイル使用メモリ 100,072 KB
実行使用メモリ 22,684 KB
最終ジャッジ日時 2023-10-13 14:38:52
合計ジャッジ時間 3,536 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
22,668 KB
testcase_01 AC 58 ms
20,712 KB
testcase_02 AC 59 ms
22,684 KB
testcase_03 AC 58 ms
20,732 KB
testcase_04 AC 58 ms
20,620 KB
testcase_05 AC 58 ms
20,588 KB
testcase_06 AC 58 ms
20,764 KB
testcase_07 AC 58 ms
20,640 KB
testcase_08 AC 58 ms
20,912 KB
testcase_09 AC 58 ms
20,828 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.Collections.Generic;
using System.Linq;


namespace PracticeAtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
			//No.26 シャッフルゲーム
			//https://yukicoder.me/problems/no/26
			//0~9のbool配列 質問毎にtlueの掛け算 最後に残ったTlueが答え
			bool[] boA = new bool[]{false,false,false};
			
			string sA = Console.ReadLine();
			int x = int.Parse(sA);
			boA[x-1] = true;
			
			//
			String sB = Console.ReadLine();
			int  y = int.Parse(sB);		
			String[] t;
			String sC;
			var vaA = false;
			var vaB = false;
			int[] iAR;
			
			for(int i = 0;i<y;i++){
				sC = Console.ReadLine();
				t = sC.Split(' ');
				iAR = Array.ConvertAll(t , int.Parse);
				vaA = boA[iAR[0]-1];
				vaB = boA[iAR[1]-1];
				
				boA[iAR[0]-1] = vaB;
				boA[iAR[1]-1] = vaA;
				
			}
			
			int z = Array.IndexOf(boA,true);
			Console.WriteLine(z+1);
		}
    }
}
0