Mistrzostwa Polski Szkół Średnich w Programowaniu Zespołowym 2024
Problem description
Guessing game
(zgadywanka-1)
This is an interactive problem.
The grader chose some positive integer K from range 1 to N (inclusive). The goal of your program is to guess the value of K asking at most 30 queries (the details are given below).
Interaction
Initially, the grader gives (to the standard input of your program)
the integer N. Then, your
program may ask queries about any integer K′ from range 1 to N. The query should be printed to
the standard output. The grader answers <
,
>
or =
to the standard input of your
program (depending on case if K < K′, K > K′ or K = K′).
Please remember about flushing the standard output buffer every query.
Limits
1 ≤ N ≤ 109.
Example interaction
Input | Output |
---|---|
10 |
|
5 |
|
> |
|
8 |
|
< |
|
7 |
|
= |
In the example test N = 10 and K = 7.