제출 #642321

#제출 시각아이디문제언어결과실행 시간메모리
642321ErennedirloGuess the number (BOI20_guess)C++17
0 / 100
2491 ms208 KiB
#include <iostream> using namespace std; int main() { int N; cin >> N; N += 1; int left = 1, right = N; while (1) { int tmp = (right - left) / 2 + left; int ans; cout << "?" << " " << tmp << "\n"; cout.flush(); cin >> ans; if (ans == -1) { right = tmp; } else if (ans == 0) { cout << "= " << tmp << "\n"; break; } else { left = tmp; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...