結果
問題 | No.253 ロウソクの長さ |
ユーザー |
![]() |
提出日時 | 2015-07-24 23:21:34 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,015 bytes |
コンパイル時間 | 1,306 ms |
コンパイル使用メモリ | 157,864 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 30.00 |
最終ジャッジ日時 | 2024-07-16 05:02:04 |
合計ジャッジ時間 | 7,525 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,x,y) for(int i=(x);i<(y);++i) #define mp(a,b) make_pair((a),(b)) #define debug(x) #x << "=" << (x) #ifdef DEBUG #define _GLIBCXX_DEBUG #define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl #else #define dump(x) #endif typedef long long int ll; typedef pair<int,int> pii; //template<typename T> using vec=std::vector<T>; const int INF=1<<30; const long long int LLNF_=1LL<<58; const double EPS=1e-9; const int dx[]={1,0,-1,0},dy[]={0,1,0,-1}; template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (const auto &v : vec) { os << v << ","; } os << "]"; return os; } void Solve(){ int lb=10,ub=1000000001; while(true){ int mid=(lb+ub)/2,res; cout << "? " << mid << endl; cin >> res; if(res==0){ cout << "! " << mid << endl; break; }else if(res==-1) ub=mid; else lb=mid; --lb; --ub; if(lb<0) lb=0; if(ub<0) ub=0; } } int main(){ Solve(); return 0; }