Cod sursa(job #3296767)
| Utilizator | Data | 16 mai 2025 19:06:31 | |
|---|---|---|---|
| Problema | Cbinteractiv | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
cout.flush();
int st = 1, dr = n;
while (st < dr) {
int mid = st + (dr - st) / 2;
cout << "? " << mid << endl;
///_sleep(3000);
cout.flush();
int rv = rand() % 2;
cout << rv << endl;
///_sleep(3000);
cout.flush();
if (rv == 1) {
dr = mid;
}
else st = mid + 1;
}
cout << "! " << st ;
}