結果

問題 No.305 鍵(2)
ユーザー mbanmban
提出日時 2017-01-01 23:43:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 1,611 bytes
コンパイル時間 2,193 ms
コンパイル使用メモリ 103,076 KB
実行使用メモリ 39,896 KB
平均クエリ数 51.23
最終ジャッジ日時 2023-09-24 00:48:57
合計ジャッジ時間 4,570 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
39,896 KB
testcase_01 AC 96 ms
39,492 KB
testcase_02 AC 88 ms
39,268 KB
testcase_03 AC 92 ms
38,060 KB
testcase_04 AC 96 ms
37,600 KB
testcase_05 AC 103 ms
37,452 KB
testcase_06 AC 79 ms
39,712 KB
testcase_07 AC 96 ms
39,380 KB
testcase_08 AC 98 ms
37,424 KB
testcase_09 AC 98 ms
39,860 KB
testcase_10 AC 96 ms
37,900 KB
testcase_11 AC 97 ms
37,412 KB
testcase_12 AC 98 ms
37,168 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.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;


class Magatro
{
    static void Main()
    {
        bool[] C = new bool[10];
        int[] ans = new int[10];
        while (true)
        {
            Write(ans);
            string[] s = Console.ReadLine().Split(' ');
            if (s[1] == "unlocked")
            {
                return;
            }
            int cnt = int.Parse(s[0]);
            int[] copy = ans.ToArray();
            for (int i = 0; i < 10; i++)
            {
                if (C[i])
                {
                    continue;
                }
                int[] cp;
                cp = ans.ToArray();
                cp[i]++;
                Write(cp);               
                string[] ss = Console.ReadLine().Split(' ');
                if (ss[1] == "unlocked") {
                    return;
                }
                int a = int.Parse(ss[0]);
                if (cnt > a)
                {
                    C[i] = true;
                }
                else if (cnt < a)
                {
                    C[i] = true;
                    copy[i] = cp[i];
                }
                else
                {
                    copy[i] = cp[i];
                }
            }
            ans = copy.ToArray();
        }
    }
    static void Write(int[] ans)
    {
        for(int i = 0; i < 10; i++)
        {
            Console.Write(ans[i]);
        }
        Console.WriteLine();
    }
}

0