結果

問題 No.24 数当てゲーム
ユーザー mrc1031mrc1031
提出日時 2016-10-12 13:43:12
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,345 bytes
コンパイル時間 2,091 ms
コンパイル使用メモリ 104,756 KB
実行使用メモリ 23,592 KB
最終ジャッジ日時 2023-08-14 07:42:41
合計ジャッジ時間 3,533 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
23,468 KB
testcase_01 AC 72 ms
19,468 KB
testcase_02 AC 72 ms
23,456 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 71 ms
23,576 KB
testcase_06 AC 73 ms
21,384 KB
testcase_07 AC 72 ms
21,532 KB
testcase_08 WA -
testcase_09 AC 70 ms
23,460 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.Linq;

class Program
{
    static void Main(string[] args)
    {
        // No.24 数当てゲーム

        var answer = new string[10];
        for (int i = 0; i <= answer.Length - 1; i++)
            answer[i] = i.ToString();

        // ターン数
        int n = int.Parse(Console.ReadLine());
        var r = new string[5];

        // ターン数分繰り返し
        for (int i = 0; i <= n - 1; i++)
        {
            r = Console.ReadLine().Split(' ');
            Array.Sort(r);

            if ("NO".Equals(r[4]))
            {
                for (int j = 0; j <= r.Length - 2; j++)
                {
                    answer[int.Parse(r[j])] = "";
                }
            }
            else
            {
                int idx = 0;

                for (int j = 0; j <= answer.Length - 1; j++)
                {
                    if (idx <= r.Length - 1 && r[idx].Equals(answer[j]))
                    {
                        idx++;
                        continue;
                    }

                    answer[j] = "";
                }
            }
        }

        for (int i = 0; i < answer.Length; i++)
        {
            if (!"".Equals(answer[i]))
            {
                Console.WriteLine(answer[i]);
                break;
            }
        }
    }
}
0