Submission #254760

#TimeUsernameProblemLanguageResultExecution timeMemory
254760model_codeGuess the number (BOI20_guess)Cpython 3
100 / 100
34 ms3412 KiB
#!/usr/bin/env python3

a, b = 1, int(input())

while a < b:
    m = (a + b) // 2
    print("? {}".format(m), flush=True)

    ans = int(input())
    if ans < 0:
        a = m + 1
    elif ans > 0:
        b = m - 1
    else:
        a = b = m

print("= {}".format(a))
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...