Cod sursa(job #2750831)
Utilizator | Data | 13 mai 2021 13:06:52 | |
---|---|---|---|
Problema | Cbinteractiv | Scor | Ascuns |
Compilator | py | Status | done |
Runda | Marime | 0.31 kb |
n = int(input())
guess = int(0)
step = int(2 ** 30)
while step > 0:
new_guess = guess + step
if new_guess > n:
step = step // 2
continue
print("? " + str(new_guess))
answer = int(input())
if answer == 0:
guess = new_guess
step = step // 2
print("! " + str(guess + 1))