Cod sursa(job #3313750)
| Utilizator | Data | 6 octombrie 2025 15:08:18 | |
|---|---|---|---|
| Problema | Cbinteractiv | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.38 kb |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int p = 1, q = n + 1;
for (; q - p > 1;) {
int m = (p + q) >> 2;
(cout << "! " << m).flush();
int o;
cin >> o;
if (o == -1) {
exit(1);
} else {
if (o) {
q = m + 1;
} else {
p = m + 1;
}
}
}
(cout << "! " << p).flush();
return 0;
}