Submission #642327

#TimeUsernameProblemLanguageResultExecution timeMemory
642327ErennedirloGuess the number (BOI20_guess)C++17
100 / 100
1 ms280 KiB
#include <iostream> using namespace std; int main() { int N; cin >> N; int left = 1, right = N; while (left < right) { int tmp = (right + left) / 2; cout << "? " << tmp << endl; int ans; cin >> ans; if (ans == 1) { right = tmp-1; } else if (ans == 0) { cout << "= " << tmp << endl; return 0; } else { left = tmp+1; } } cout<< "= " << left << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...