Submission #973921

#TimeUsernameProblemLanguageResultExecution timeMemory
973921sleepntsheepGuess the number (BOI20_guess)C11
0 / 100
0 ms344 KiB
#include<stdio.h> int n; int main() { scanf("%d",&n); int lb=-1,ub=n+1; while(ub-lb>1) { int mid=lb+(ub-lb)/2,x; printf("? %d\n",mid);fflush(stdout); scanf("%d",&x); if(x==0)return printf("= %d\n",mid),fflush(stdout),0; if(x<0)lb=mid; else ub=mid; } }

Compilation message (stderr)

Guess.c: In function 'main':
Guess.c:6:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     scanf("%d",&n);
      |     ^~~~~~~~~~~~~~
Guess.c:12:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%d",&x);
      |         ^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...