結果
問題 |
No.26 シャッフルゲーム
|
ユーザー |
|
提出日時 | 2023-10-13 14:38:47 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 5,000 ms |
コード長 | 949 bytes |
コンパイル時間 | 1,023 ms |
コンパイル使用メモリ | 103,552 KB |
実行使用メモリ | 18,176 KB |
最終ジャッジ日時 | 2024-09-15 11:24:41 |
合計ジャッジ時間 | 1,946 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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); } } }