Logo
(追記) (追記ここまで)

19554번 - Guess the number 서브태스크다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.3 초 (추가 시간 없음) 256 MB104738831837.633%

문제

Write a program that guesses an integer X in the range 1, . . . , N.

입력

출력

제한

프로토콜

This is an interactive task. When your program starts, the first line of input contains the integer N (1 ≤ N ≤ 109). The value of X is kept secret by the grading system.

Then your program can issue queries by writing them to the output in the form “? P”, where P is an integer (1 ≤ P ≤ N). The grading system writes the response in the next line of the input. The response is −1 if P < X, 0 if P = X, and 1 if P > X. Your program may issue at most 50 queries in each test case.

When your program wants to guess the number X, it should output “= X” (1 ≤ X ≤ N) and terminate. The grading system will not respond to this output and will not accept further queries after that.

서브태스크

번호배점제한
129

1 ≤ N ≤ 50

271

No further constraints

예제 입력 1

5
-1
1
0

예제 출력 1

? 1
? 3
? 2
= 2

힌트

출처

Olympiad > Baltic Olympiad in Informatics > BOI 2020 연습 세션 PA번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /