結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
23,488 KB
testcase_01 AC 78 ms
21,504 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 79 ms
23,460 KB
testcase_08 WA -
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.Linq;

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

        var answer = new string[10];
        for (int i = 1; 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; i++)
        {
            r = Console.ReadLine().Split(' ');
            Array.Sort(r);

            if ("NO".Equals(r[4]))
            {
                for (int j = 0; j < r.Length - 1; j++)
                {
                    answer[int.Parse(r[j])] = null;
                }
            }
            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] = null;
                }
            }
        }

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