結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
24,556 KB
testcase_01 AC 39 ms
24,708 KB
testcase_02 AC 37 ms
24,140 KB
testcase_03 AC 38 ms
24,232 KB
testcase_04 WA -
testcase_05 AC 37 ms
24,112 KB
testcase_06 AC 40 ms
24,328 KB
testcase_07 AC 39 ms
24,552 KB
testcase_08 AC 40 ms
24,044 KB
testcase_09 WA -
testcase_10 AC 38 ms
24,460 KB
testcase_11 AC 38 ms
23,920 KB
testcase_12 AC 39 ms
24,236 KB
testcase_13 AC 39 ms
23,916 KB
testcase_14 WA -
testcase_15 AC 38 ms
24,260 KB
testcase_16 AC 38 ms
24,224 KB
testcase_17 AC 37 ms
23,616 KB
testcase_18 AC 39 ms
23,892 KB
testcase_19 WA -
testcase_20 AC 37 ms
24,164 KB
testcase_21 AC 37 ms
24,192 KB
testcase_22 WA -
testcase_23 AC 38 ms
23,912 KB
testcase_24 AC 38 ms
24,324 KB
testcase_25 AC 38 ms
23,968 KB
testcase_26 AC 40 ms
24,316 KB
testcase_27 AC 40 ms
23,952 KB
testcase_28 AC 40 ms
24,528 KB
testcase_29 AC 39 ms
24,408 KB
testcase_30 AC 39 ms
24,384 KB
testcase_31 AC 39 ms
24,512 KB
testcase_32 AC 40 ms
23,624 KB
testcase_33 AC 38 ms
23,664 KB
testcase_34 WA -
testcase_35 AC 38 ms
23,868 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 = int(math.fabs(max_num - 1))
    min_num = int(math.fabs(min_num - 1))
    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