結果

問題 No.24 数当てゲーム
ユーザー n.yn.y
提出日時 2022-06-07 09:53:46
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,252 bytes
コンパイル時間 879 ms
コンパイル使用メモリ 109,104 KB
実行使用メモリ 24,080 KB
最終ジャッジ日時 2023-10-21 03:48:01
合計ジャッジ時間 1,748 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
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.Diagnostics;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //ターン数 N個配列ある
            int N = int.Parse(Console.ReadLine());
            //入力した配列
            string[] a = new string[5];

            //比較用数字
            string[] z = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
            //プラスマイナスを入れる配列
            int[] u = { 0,0, 0, 0, 0, 0, 0, 0, 0, 0 };

            //N 配列にYESがいくつあるか
            int yes = 0;


            //N回ループ
            for (int k = 0; k < N; k++)
            {
                //文字の分割
                string[] strA = Console.ReadLine().Split(' ');

                //入力したものを配列に入れる
                for (int i=0;i<5;i++)
                {

                    string str = strA[i];
                    a[i] = str;

                    //YESがあれば+1する
                    if(i==4&&a[4]=="YES")
                    {
                        yes += 1;
                    }
                 }

                //0から9まで
                for (int i = 0; i < 10; i++)
                {
                    //入力した配列
                    for (int j = 0; j < 5; j++)
                    {
                        //NOなら-1
                        if (a[4] == "NO" && a[j] == z[i])
                        {
                            u[i] -= 1;
                            break;

                        }
                        //YESなら+1
                        else //if(a[4]=="YES"&&a[j]==z[i])
                        {
                            u[i] += 1;
                            break;
                        }

                    }
                }
            }

            //一番大きな数字の判定
            for (int i = 0; i < 10; i++)
            {
                //yesと同じ配列があれば、表示する
                if (u[i] == yes)
                {
                    Console.WriteLine(z[i]);
                    //Debug.WriteLine(z[i]);
                }
            }
        }
    }
    
}
            
0