Cod sursa(job #2750830)
| Utilizator | Data | 13 mai 2021 13:05:52 | |
|---|---|---|---|
| Problema | Cbinteractiv | Scor | Ascuns |
| Compilator | py | Status | done |
| Runda | Marime | 0.32 kb |
n = int(input())
guess : int = 0
step : int = 2 ** 30
while step > 0:
new_guess : int = 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))
