Cod sursa(job #3362893)
| Utilizator | Data | 13 august 2026 02:18:56 | |
|---|---|---|---|
| Problema | Cbinteractiv | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.4 kb |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int st, dr, mij, x;
scanf("%d", &dr);
st = 0;
while (dr - st > 1) {
mij = (st + dr) / 2;
printf("? %d\n", mij);
fflush(stdout);
scanf("%d", &x);
if (x == 0) {
st = mij;
} else {
dr = mij;
}
}
printf("! %d\n", dr);
return 0;
}
