Pagini recente » Cod sursa (job #3313765) | Diferente pentru problema/hidden_points intre reviziile 41 si 63 | Diferente pentru problema/hidden_points intre reviziile 47 si 63 | Cod sursa (job #3166806) | Cod sursa (job #3288283)
#include <bits/stdc++.h>
using namespace std;
int n, st, dr, poz;
int main() {
cin >> n;
st = 0;
dr = n;
while(st <= dr) {
int mij = st + (dr - st) / 2;
cout << "? " << mij << endl;
cout.flush();
int x;
cin >> x;
if(x == 0) {
poz = mij;
st = mij + 1;
}
else dr = mij - 1;
}
cout << "! " << poz << endl;
cout.flush();
return 0;
}