結果

問題 No.253 ロウソクの長さ
ユーザー NoNo
提出日時 2017-05-28 13:21:44
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,075 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 106,608 KB
実行使用メモリ 40,964 KB
平均クエリ数 31.08
最終ジャッジ日時 2023-09-23 14:11:07
合計ジャッジ時間 8,586 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 77 ms
38,272 KB
testcase_02 AC 80 ms
38,896 KB
testcase_03 AC 76 ms
36,340 KB
testcase_04 AC 79 ms
36,900 KB
testcase_05 AC 75 ms
36,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 72 ms
34,420 KB
testcase_10 WA -
testcase_11 AC 72 ms
36,468 KB
testcase_12 WA -
testcase_13 AC 76 ms
38,996 KB
testcase_14 AC 73 ms
36,268 KB
testcase_15 AC 73 ms
34,536 KB
testcase_16 AC 72 ms
36,976 KB
testcase_17 AC 68 ms
38,592 KB
testcase_18 AC 75 ms
36,264 KB
testcase_19 AC 73 ms
36,596 KB
testcase_20 WA -
testcase_21 AC 75 ms
36,592 KB
testcase_22 AC 78 ms
38,440 KB
testcase_23 WA -
testcase_24 AC 72 ms
36,724 KB
testcase_25 AC 71 ms
36,692 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 72 ms
38,816 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 73 ms
36,360 KB
testcase_35 AC 76 ms
38,328 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 - 1);
                    return;
                }
                else
                {
                    c++;
                }
            }
        }
    }
}
0