Cod sursa(job #2768942)
Utilizator | Data | 12 august 2021 18:18:30 | |
---|---|---|---|
Problema | Cbinteractiv | Scor | 100 |
Compilator | c-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.27 kb |
#include<stdio.h>
int d,s,o,m;
int main()
{
for(scanf("%d",&d),s=1;s<=d;) {
m=(s+d)>>1,printf("? %d\n",m),fflush(stdout),scanf("%d",&o);
if(!o)
s=m+1;
else
d=m-1;
}
printf("! %d",s),
fflush(stdout);
}