# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
728033 | rainboy | Guess the number (BOI20_guess) | C11 | 1 ms | 276 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
int main() {
int n, lower, upper;
scanf("%d", &n);
lower = 1, upper = n;
while (1) {
int a, c;
a = (lower + upper) / 2;
printf("? %d\n", a), fflush(stdout);
scanf("%d", &c);
if (c < 0)
lower = a + 1;
else if (c > 0)
upper = a - 1;
else {
printf("= %d\n", a), fflush(stdout);
break;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |