結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  fujita | 
| 提出日時 | 2023-04-27 15:09:19 | 
| 言語 | C# (.NET 8.0.404) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 4,716 bytes | 
| コンパイル時間 | 10,288 ms | 
| コンパイル使用メモリ | 168,328 KB | 
| 実行使用メモリ | 185,776 KB | 
| 最終ジャッジ日時 | 2024-11-16 21:31:47 | 
| 合計ジャッジ時間 | 11,454 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 9 WA * 1 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (84 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) /home/judge/data/code/Main.cs(14,31): warning CS0219: 変数 'z' は割り当てられていますが、その値は使用されていません [/home/judge/data/code/main.csproj] main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System.Collections.Generic;
using System;
using System.Linq;
using System.Drawing;
namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int m = 0, x = 1, z = 1;
            var list = new List<string>() {"0", "1", "2", "3", "4", "5",
                                             "6" , "7" , "8" , "9" ,};
            var anslist = new List<string>();
            var newanslist = new List<string>();
            for (int i = 0; i < N; i++)
            {
                var a = Console.ReadLine();
                var A = a.Split();
                if (a.Contains("YES"))
                {
                    anslist.Add(A[0]);
                    anslist.Add(A[1]);
                    anslist.Add(A[2]);
                    anslist.Add(A[3]);
                    anslist.Sort();
                    
                }
                else if (a.Contains("NO"))
                {
                    list.Remove(A[0]);
                    list.Remove(A[1]);
                    list.Remove(A[2]);
                    list.Remove(A[3]);
                    
                }
            }
            
            //新しいリストにanslistで重複している数字を入れる
            for(int j = 0; j < anslist.Count - 1; j++)
            {
                if (anslist[j] == anslist[x]) 
                {
                    x++;
                    newanslist.Add(anslist[j]);
                }
                else
                {
                    x++;
                    continue;
                }
                
            }
            //listの要素が1つかnewanslistの要素が1つか
            if(list.Count == 1 || newanslist.Count == 1)
            {
                if(list.Count == 1)
                {
                    Console.WriteLine(list[0]);
                }
                else
                {
                    Console.WriteLine(newanslist[0]);
                }
            }else if (list.Count > 1 && newanslist.Count > 1)
            {//listの要素が1つ以上かnewanslistの要素が1つ以上か
                if (newanslist.Count > list.Count || !(anslist.Count < 1))
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        
                        for(int j = 0; j < newanslist.Count; j++)
                        {
                            
                            for (m = 0; m < newanslist.Count - 1; m++)
                            {
                                if (newanslist[m].Equals(newanslist[m + 1]))
                                {
                                    Console.WriteLine(newanslist[m]);
                                    break;
                                }
                               
                            }
                            
                            if (!(m == 0))
                            {
                                break;
                            }
                        }
                        for (int zz = 0; zz < newanslist.Count - 1;zz++)
                        {
                            if (list[i].Equals(newanslist[zz]))
                            {
                                Console.WriteLine(list[i]);
                                break;
                            }
                        }
                        
                    }
                }
                
            }
            else if (list.Count > 1 && newanslist.Count > 1 && anslist.Count > 1)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    for (int j = 0; j < newanslist.Count; j++)
                    {
                        for(int k = 0; k < anslist.Count; k++)
                        { 
                            if (list[i].Equals(newanslist[j]) && list[i].Equals(anslist[j]))
                            {
                                Console.WriteLine(list[i]);
                                break;
                            }
                        }
                    }
                }
            }
            else if (newanslist.Count == 0 )
            {
                for (int i = 0; i < list.Count; i++)
                {
                    for (int j = 0; j < anslist.Count; j++)
                    {
                        if (list[i].Equals(anslist[j]))
                        {
                            Console.WriteLine(list[i]);
                            break;
                        }
                    }
                }
            }
        }
    }
}
            
            
            
        