Cod sursa(job #2964512)
Utilizator | Data | 13 ianuarie 2023 09:37:22 | |
---|---|---|---|
Problema | Cbinteractiv | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <bits/stdc++.h>
using namespace std;
int n,st,dr,m,x;
int main()
{
cin >> n;
st=1;
dr=n;
while(st<dr){
m=(st+dr)/2;
cout << "? " << m << endl;
cin >> x;
if(x==0){
st=m+1;
}
else dr=m;
}
cout << "! " << st;
return 0;
}