結果

問題 No.305 鍵(2)
ユーザー 14番14番
提出日時 2016-05-16 01:44:50
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 3,556 bytes
コンパイル時間 2,935 ms
コンパイル使用メモリ 110,996 KB
実行使用メモリ 40,016 KB
平均クエリ数 30.00
最終ジャッジ日時 2023-09-23 10:38:04
合計ジャッジ時間 5,424 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
38,144 KB
testcase_01 AC 92 ms
37,836 KB
testcase_02 AC 93 ms
35,868 KB
testcase_03 WA -
testcase_04 AC 98 ms
37,836 KB
testcase_05 AC 86 ms
37,624 KB
testcase_06 AC 85 ms
37,704 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 94 ms
36,076 KB
testcase_11 WA -
testcase_12 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.Collections.Generic;
using System.Text;
using System.Linq;

class Program
{
    public void Proc()
    {
        
        Dictionary<int, int> dic = new Dictionary<int, int>();
        for(int i=0; i<=9; i++) {
            Console.WriteLine(string.Empty.PadLeft(10, i.ToString()[0]));
            string[] ret = Console.ReadLine().Split(' ');
            int num = int.Parse(ret[0]);
            if(num == 10) {
                return;
            }
            dic.Add(i, num);
        }
        if(dic.Count(a=>a.Value == 0) > 0) {
            Nullable<int>[] map = new Nullable<int>[10];
            int umeNum = dic.Where(a=>a.Value == 0).First().Key;
            for(int i=0; i<9; i++) {
                if(dic[i] == 0) {
                    continue;
                }
                for(int j=0; j<dic[i]; j++) {
                    for(int k=0; k<10; k++) {
                        if(map[k] != null) {
                            continue;
                        }
                        int[] lst = new int[10];
                        lst = lst.Select(a=>umeNum).ToArray();
                        lst[k] = i;
                        Console.WriteLine(string.Join(string.Empty, lst));
                        string[] ret = Console.ReadLine().Split(' ');
                        int cnt = int.Parse(ret[0]);
                        if(cnt == 10) {
                            return;
                        }
                        if(cnt == 1) {
                            map[k] = i;
                            break;
                        }
                    }
                }
            }
            Console.WriteLine(string.Join(string.Empty, map));
            string ans = Console.ReadLine();
        } else
        {
            Nullable<int>[] map = new Nullable<int>[10];
            for(int i=0; i<= 8; i++) {
                for(int j=0; j<10; j++) {
                    if(map[j] != null) {
                        continue;
                    }
                    int[] tmp = new int[10];
                    tmp = tmp.ToList().Select(a=> 9).ToArray();
                    tmp[j] = i;
                    Console.WriteLine(string.Join(string.Empty, tmp));
                    string[] ret = Console.ReadLine().Split(' ');
                    int cnt = int.Parse(ret[0]);
                    if(cnt == 10) {
                        return;
                    }
                    if(cnt == 2) {
                        map[j] = i;
                        break;
                    }
                }
            }
            for(int i=0; i<map.Length; i++) {
                if(map[i] == null) {
                    map[i] = 9;
                }
            }
            Console.WriteLine(string.Join(string.Empty, map));
            string ans = Console.ReadLine();
            return;
        }
    }
    
    
    

    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"




 
";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0