結果
問題 | No.246 質問と回答 |
ユーザー |
![]() |
提出日時 | 2015-07-18 01:28:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 60 ms / 2,000 ms |
コード長 | 395 bytes |
コンパイル時間 | 485 ms |
コンパイル使用メモリ | 58,020 KB |
実行使用メモリ | 25,220 KB |
平均クエリ数 | 30.87 |
最終ジャッジ日時 | 2024-07-16 19:47:22 |
合計ジャッジ時間 | 3,933 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:25:17: warning: ‘rez’ may be used uninitialized in this function [-Wmaybe-uninitialized] 25 | cout<<"! "<<rez; | ^~~
ソースコード
#include <iostream> #include <algorithm> using namespace std; typedef long long ll; int main() { int l=1,r=1000000000; int ans,rez; while(l<=r){ int mid=(l+r)/2; cout<<"? "<<mid<<endl; cin>>ans; if(ans==1){ rez=mid; l=mid+1; } else{ r=mid-1; } } cout<<"! "<<rez; return 0; }