結果
問題 | No.246 質問と回答 |
ユーザー |
![]() |
提出日時 | 2017-07-26 10:58:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 352 bytes |
コンパイル時間 | 1,502 ms |
コンパイル使用メモリ | 156,780 KB |
実行使用メモリ | 42,404 KB |
平均クエリ数 | 2.70 |
最終ジャッジ日時 | 2024-07-16 20:13:45 |
合計ジャッジ時間 | 5,213 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 TLE * 1 -- * 26 |
コンパイルメッセージ
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)/2);fflush(stdout);int ans;scanf("%d",&ans);if(ans){min = (min+max)/2+1;}else{max = (min+max)/2-1;}}printf("! %d\n",min);fflush(stdout);}