Cod sursa(job #2763865)
Utilizator | Data | 17 iulie 2021 13:23:28 | |
---|---|---|---|
Problema | Cbinteractiv | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <bits/stdc++.h>
using namespace std;
int st,dr,mid,r;
int main(){
cin>>dr;
st=1;
while(st<=dr){
mid=(st+dr)/2;
cout<<"? "<<mid<<"\n";
cout.flush();
cin>>r;
if(r==0)
st=mid+1;
else
dr=mid-1;
}
cout<<"! "<<st<<"\n";
cout.flush();
return 0;
}