제출 #642319

#제출 시각아이디문제언어결과실행 시간메모리
642319cigneveGuess the number (BOI20_guess)C++14
0 / 100
0 ms208 KiB
#pragma GCC optimize ("O3")
#include <stdio.h>
int main(){
  int N,input=5;
  scanf("%d",&N);
  int l=1,r=N;
  while (input!=0){
    printf("? %d\n",(r-l)/2+l);
    scanf("%d",&input);
    if (input==1){
      l=(r-l)/2+l;
    }
    else if (input==-1){
      r=(r-l)/2+l;
    }
  }
  printf("= %d",(r-l)/2+l);
}

컴파일 시 표준 에러 (stderr) 메시지

Guess.cpp: In function 'int main()':
Guess.cpp:5:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |   scanf("%d",&N);
      |   ~~~~~^~~~~~~~~
Guess.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d",&input);
      |     ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...