結果

問題 No.253 ロウソクの長さ
ユーザー jitomeskyjitomesky
提出日時 2015-08-01 17:06:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 758 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 24,796 KB
平均クエリ数 30.31
最終ジャッジ日時 2023-09-23 05:28:14
合計ジャッジ時間 4,073 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
24,084 KB
testcase_01 AC 40 ms
24,420 KB
testcase_02 AC 39 ms
24,240 KB
testcase_03 AC 40 ms
24,260 KB
testcase_04 WA -
testcase_05 AC 38 ms
24,700 KB
testcase_06 AC 40 ms
24,596 KB
testcase_07 AC 38 ms
23,956 KB
testcase_08 AC 40 ms
24,640 KB
testcase_09 WA -
testcase_10 AC 39 ms
24,560 KB
testcase_11 AC 39 ms
24,432 KB
testcase_12 AC 38 ms
24,624 KB
testcase_13 AC 40 ms
24,224 KB
testcase_14 WA -
testcase_15 AC 39 ms
23,836 KB
testcase_16 AC 40 ms
24,120 KB
testcase_17 AC 40 ms
24,628 KB
testcase_18 AC 39 ms
23,928 KB
testcase_19 WA -
testcase_20 AC 38 ms
24,232 KB
testcase_21 AC 39 ms
24,152 KB
testcase_22 WA -
testcase_23 AC 38 ms
24,204 KB
testcase_24 AC 37 ms
23,952 KB
testcase_25 AC 40 ms
24,256 KB
testcase_26 AC 39 ms
24,092 KB
testcase_27 AC 38 ms
24,284 KB
testcase_28 AC 37 ms
24,728 KB
testcase_29 AC 38 ms
23,836 KB
testcase_30 AC 38 ms
23,712 KB
testcase_31 AC 38 ms
24,528 KB
testcase_32 AC 39 ms
23,908 KB
testcase_33 AC 39 ms
23,796 KB
testcase_34 WA -
testcase_35 AC 38 ms
23,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math

def question(num):
    print("? %d" % num)
    sys.stdout.flush()
    n = int(input())
    return n

def result(num):
    print("! %d" % num)
    sys.stdout.flush()

# main
max_num = 1e9
judge = int(max_num / 2)
min_num = 10

for i in range(0,29):
    r = question(judge)
    if r == 1:
        # higer
        min_num = judge
    elif r == -1:
        # low
        max_num = judge
    else:
        result(judge + i)
        sys.exit()
    max_num -= 1
    min_num -= 1
    max_num = max_num if max_num >= 0 else 0
    min_num = min_num if min_num >= 0 else 0
    judge = int((max_num - min_num) / 2) + min_num

judge = min_num

for i in range(29,100):
    r = question(judge)
    if r == 0:
        result(judge + i)
        break
0