Submission #254764

#TimeUsernameProblemLanguageResultExecution timeMemory
254764model_codeGuess the number (BOI20_guess)C++14
100 / 100
1 ms384 KiB
#include <iostream> using namespace std; int main() { int a = 1, b; cin >> b; while (a < b) { int m = (a + b) / 2; cout << "? " << m << endl; int ans; cin >> ans; if (ans < 0) { a = m + 1; } else if (ans > 0) { b = m - 1; } else { a = b = m; } } cout << "= " << a << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...