結果
問題 | No.253 ロウソクの長さ |
ユーザー |
![]() |
提出日時 | 2015-08-06 12:59:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 590 bytes |
コンパイル時間 | 1,467 ms |
コンパイル使用メモリ | 159,020 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 33.94 |
最終ジャッジ日時 | 2024-07-16 05:38:25 |
合計ジャッジ時間 | 3,993 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 WA * 1 |
ソースコード
#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<1){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){lb=mid;}else ub=mid;cnt++;}cout<<"! "<<lb<<endl;return 0;}