結果
問題 |
No.253 ロウソクの長さ
|
ユーザー |
![]() |
提出日時 | 2015-07-24 22:37:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 943 bytes |
コンパイル時間 | 820 ms |
コンパイル使用メモリ | 72,700 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 49.47 |
最終ジャッジ日時 | 2024-07-16 04:58:29 |
合計ジャッジ時間 | 5,216 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 9 |
ソースコード
#include <cstdio> #include <cstdlib> #include <iostream> #include <string> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <cstring> typedef long long ll; using namespace std; #define mod 1000003 #define INF 1000000000 #define LLINF 2000000000000000000LL #define SIZE 100 int ask(int Y){ cout << "? " << Y << endl; int res; cin >> res; return res; } int main(){ int res; int l=10,r=1000000000,mid; for(int i=0;i<50;i++){ mid = (l+r)/2; int q = ask(mid-i*2); if(q==1){ l=mid+1; }else if(q==-1){ r = mid-1; }else{ cout << "! " << mid << endl; return 0; } if(ask(0)==0){ cout << "! " << i*2+1 << endl; return 0; } } return 0; }