제출 #851044

#제출 시각아이디문제언어결과실행 시간메모리
851044_Knyaz_Guess the number (BOI20_guess)C++17
0 / 100
0 ms432 KiB
/// 18.09.2023 16:09
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n; cin >> n;
    int l = 1, r = 100;
    while(l <= r){
        int mid = (l + r) / 2;
        cout << "? " << mid << endl; cout.flush();
        int q; cin >> q;
        if(!q){ cout << "= " << mid; return 0; }
        else if(q > 0) r = mid - 1;
        else l = mid + 1;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...