제출 #868740

#제출 시각아이디문제언어결과실행 시간메모리
868740Dec0DeddGuess the number (BOI20_guess)C++14
0 / 100
1 ms344 KiB
#include <bits/stdc++.h> using namespace std; int ask(int x) { cout<<"? "<<x<<endl; int r; cin>>r; return r; } int main() { int n; cin>>n; int l=1, r=n; while (l <= r) { int m=(l+r)/2; int k=ask(m); if (k == -1) r=m-1; else if (k == 1) l=m+1; else { cout<<"= "<<m<<endl; return 0; } } assert(false); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...