Cod sursa(job #3032266)
Utilizator | Data | 21 martie 2023 20:31:49 | |
---|---|---|---|
Problema | Cbinteractiv | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.47 kb |
#include <bits/stdc++.h>
using ll=long long;
#define S second
#define F first
#define endl '\n'
#define spid ios_base::sync_with_stdio(false);cin.tie(NULL);
const int mod=1e9+7;
const double pi=3.14159265359;
const int maxn=200001;
using namespace std;
int n;
int main(){
cin>>n;
int l=1,r=n;
int mid,last=0;
while(l<r){
mid=(l+r)/2;
cout<<"? "<<mid<<endl;
int x;
cin>>x;
if(x){
r=mid;
}
else l=mid+1;
}
cout<<"! "<<l<<endl;
}