結果
問題 | No.253 ロウソクの長さ |
ユーザー |
![]() |
提出日時 | 2015-08-06 12:58:21 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 591 bytes |
コンパイル時間 | 1,390 ms |
コンパイル使用メモリ | 158,020 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 95.25 |
最終ジャッジ日時 | 2024-07-16 05:38:34 |
合計ジャッジ時間 | 8,472 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 34 |
ソースコード
#include<bits/stdc++.h>using namespace std;int ask(int Y){cout<<"? "<<Y<<endl;int res;cin>>res;return res;}int main(){int x=ask(80);if(x>=0){for(int i=1;i<100;i++){x=ask(0);if(x==0){cout<<"! "<<i<<endl;return 0;}}}int cnt=1;int lb=80,ub=1e9;while(ub-lb>1){int mid=(ub+lb)/2;x=ask(mid-cnt);if(x>=0){ub=mid;}else lb=mid;cnt++;}cout<<"! "<<lb<<endl;return 0;}