Pagini recente » Atasamentele paginii Paralelograme | Cod sursa (job #1869234) | Cod sursa (job #2751015) | Diferente pentru problema/hektor intre reviziile 7 si 32 | Cod sursa (job #3243982)
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
int l = 1, r = n;
int ans = 0;
while (l <= r) {
int tm = (l + r) / 2;
cout << "? " << tm << " " << '\n';
cout.flush();
int nr;
cin >> nr;
if (nr) {
ans = max(ans, tm);
r = tm - 1;
}
else {
l = tm + 1;
}
}
cout << "! " << l << " " << '\n';
cout.flush();
}