Submission #973923

#TimeUsernameProblemLanguageResultExecution timeMemory
973923sleepntsheepGuess the number (BOI20_guess)C11
100 / 100
1 ms596 KiB
#include<stdio.h> int n; int main() { scanf("%d",&n); int lb=0,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...