Submission #666677

#TimeUsernameProblemLanguageResultExecution timeMemory
666677divadGuess the number (BOI20_guess)C++14
100 / 100
2 ms296 KiB
#include <iostream> using namespace std; int n,st,dr,val; int main() { cin >> n; int st = 1, dr = n; while(st <= dr){ int mid = (st+dr)/2; cout << "? " << mid; cout << endl; cin >> val; if(val == 0){ cout << "= " << mid; cout << endl; return 0; } if(val == -1){ st = mid+1; }else{ dr = mid-1; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...