제출 #367280

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