結果
問題 |
No.246 質問と回答
|
ユーザー |
![]() |
提出日時 | 2017-07-26 11:14:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 354 bytes |
コンパイル時間 | 1,149 ms |
コンパイル使用メモリ | 157,120 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 27.73 |
最終ジャッジ日時 | 2024-07-16 13:59:26 |
合計ジャッジ時間 | 4,197 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 WA * 8 |
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 2 | main(){ | ^~~~ main.cpp: In function ‘int main()’: main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d",&ans); | ~~~~~^~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> main(){ int min = 0,max = 100000000; while(min!=max){ printf("? %d\n",(min+max+1)/2); fflush(stdout); int ans; scanf("%d",&ans); if(ans){ min = (min+max+1)/2; }else{ max = (min+max-1)/2; } } printf("! %d\n",min); fflush(stdout); }