# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1266559 | raphaelp | Guess the number (BOI20_guess) | C++20 | 0 ms | 408 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin >> N;
int L = 1, R = N + 1;
while (L + 1 != R)
{
int m = (L + R) / 2;
cout << "? " << m << endl;
int ans;
cin >> ans;
if (ans == 1)
R = m;
else
L = m;
}
cout << "= " << L << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |