제출 #257460

#제출 시각아이디문제언어결과실행 시간메모리
257460dolphingarlicGuess the number (BOI20_guess)Cpython 3
100 / 100
32 ms3564 KiB
import sys
n = int(input())
l = 1
r = n
while True:
  mid = (l + r) // 2
  print(f'? {mid}')
  sys.stdout.flush()
  res = int(input())
  if res == -1:
    l = mid + 1
  elif res == 1:
    r = mid - 1
  else:
    print(f'= {mid}')
    sys.stdout.flush()
    break
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...