結果

問題 No.246 質問と回答
ユーザー 14番14番
提出日時 2016-05-14 23:42:52
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 1,028 bytes
コンパイル時間 3,634 ms
コンパイル使用メモリ 100,636 KB
実行使用メモリ 38,352 KB
平均クエリ数 32.23
最終ジャッジ日時 2023-09-23 20:15:41
合計ジャッジ時間 8,413 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
36,744 KB
testcase_01 AC 94 ms
36,180 KB
testcase_02 AC 95 ms
38,352 KB
testcase_03 AC 94 ms
30,232 KB
testcase_04 AC 93 ms
30,424 KB
testcase_05 AC 96 ms
30,656 KB
testcase_06 AC 95 ms
30,700 KB
testcase_07 AC 95 ms
30,488 KB
testcase_08 AC 94 ms
30,084 KB
testcase_09 AC 93 ms
30,756 KB
testcase_10 AC 93 ms
30,536 KB
testcase_11 AC 93 ms
30,500 KB
testcase_12 AC 93 ms
30,296 KB
testcase_13 AC 94 ms
30,008 KB
testcase_14 AC 94 ms
30,452 KB
testcase_15 AC 93 ms
30,644 KB
testcase_16 AC 95 ms
30,480 KB
testcase_17 AC 94 ms
30,500 KB
testcase_18 AC 93 ms
30,664 KB
testcase_19 AC 92 ms
30,420 KB
testcase_20 AC 94 ms
30,660 KB
testcase_21 AC 95 ms
30,456 KB
testcase_22 AC 93 ms
30,516 KB
testcase_23 AC 94 ms
30,764 KB
testcase_24 AC 94 ms
30,360 KB
testcase_25 AC 94 ms
30,740 KB
testcase_26 AC 94 ms
30,028 KB
testcase_27 AC 95 ms
30,748 KB
testcase_28 AC 95 ms
30,168 KB
testcase_29 AC 94 ms
30,720 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.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    public void Proc()
    {
        long ans = this.GetAns(1, 1000000000);
        Console.WriteLine("! " + ans);


    }

    private long GetAns(long min, long max)
    {
        long mid = (min + max) / 2;
        Console.WriteLine("? " + mid);
        bool isBigger = Console.ReadLine().Equals("1");

        if (isBigger && max - mid <= 1)
        {
            Console.WriteLine("? " + max);
            isBigger = Console.ReadLine().Equals("1");
            if (isBigger)
            {
                return max;
            }
            else
            {
                return mid;
            }
        }
        if (isBigger)
        {
            return this.GetAns(mid, max);
        }
        else
        {
            return this.GetAns(min, mid);
        }
    }




    static void Main(string[] args)
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0