結果

問題 No.253 ロウソクの長さ
ユーザー NoNo
提出日時 2017-05-28 13:22:36
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 2,071 bytes
コンパイル時間 1,826 ms
コンパイル使用メモリ 102,112 KB
実行使用メモリ 39,056 KB
平均クエリ数 31.08
最終ジャッジ日時 2023-09-24 01:19:07
合計ジャッジ時間 6,586 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
36,844 KB
testcase_01 AC 75 ms
36,556 KB
testcase_02 AC 74 ms
36,376 KB
testcase_03 AC 75 ms
36,436 KB
testcase_04 AC 73 ms
36,628 KB
testcase_05 AC 77 ms
38,704 KB
testcase_06 AC 80 ms
36,760 KB
testcase_07 AC 79 ms
36,684 KB
testcase_08 AC 73 ms
38,792 KB
testcase_09 AC 75 ms
36,784 KB
testcase_10 AC 76 ms
36,900 KB
testcase_11 AC 73 ms
36,384 KB
testcase_12 AC 76 ms
36,428 KB
testcase_13 AC 79 ms
38,976 KB
testcase_14 AC 77 ms
38,304 KB
testcase_15 AC 75 ms
34,836 KB
testcase_16 AC 72 ms
34,940 KB
testcase_17 AC 70 ms
37,004 KB
testcase_18 AC 76 ms
34,548 KB
testcase_19 AC 76 ms
39,056 KB
testcase_20 AC 74 ms
38,568 KB
testcase_21 AC 72 ms
36,860 KB
testcase_22 AC 73 ms
34,992 KB
testcase_23 AC 73 ms
36,888 KB
testcase_24 AC 75 ms
36,644 KB
testcase_25 AC 73 ms
36,952 KB
testcase_26 AC 75 ms
36,672 KB
testcase_27 AC 75 ms
36,692 KB
testcase_28 AC 73 ms
36,740 KB
testcase_29 AC 72 ms
36,792 KB
testcase_30 AC 76 ms
36,984 KB
testcase_31 AC 76 ms
36,976 KB
testcase_32 AC 75 ms
38,444 KB
testcase_33 AC 72 ms
36,712 KB
testcase_34 AC 71 ms
36,560 KB
testcase_35 AC 75 ms
36,760 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.Linq;
using System.Text;
namespace Yuki
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("? 100");
            string a = Console.ReadLine();
            if (a == "0")
            {
                Console.WriteLine("! 100");
            }
            else if (a == "-1")
            {
                aa();
            }
            else
            {
                bb();
            }
        }

        static void aa()
        {
            int c = 1;
            while (true)
            {
                Console.WriteLine("? 9");
                if (Console.ReadLine() == "0")
                {
                    Console.WriteLine("! {0}", 9 + c);
                    break;
                }
                else
                {
                    c++;
                }
            }
        }

        static void bb()
        {
            int ma = 1000000000 - 1;
            int mi = 100;
            int c = 1;
            int y = -1;
            int r = ma;
            while (ma - mi > 5)
            {
                y = (ma + mi) / 2;
                Console.WriteLine("? {0}", y);
                string a = Console.ReadLine();
                if (a == "0")
                {
                    Console.WriteLine("! {0}", y + c);
                    return;
                }
                else if (a == "-1")
                {
                    ma = y - 1;
                    mi -= 1;
                    c++;
                }
                else
                {
                    ma -= 1;
                    mi = y - 1;
                    c++;
                }
            }

            while (true)
            {
                Console.WriteLine("? {0}", mi);
                if (Console.ReadLine() == "0")
                {
                    Console.WriteLine("! {0}", mi + c);
                    return;
                }
                else
                {
                    c++;
                }
            }
        }
    }
}
0