Submission #1266559

#TimeUsernameProblemLanguageResultExecution timeMemory
1266559raphaelpGuess the number (BOI20_guess)C++20
100 / 100
0 ms408 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...