結果
問題 |
No.246 質問と回答
|
ユーザー |
![]() |
提出日時 | 2017-07-19 13:45:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 55 ms / 2,000 ms |
コード長 | 781 bytes |
コンパイル時間 | 766 ms |
コンパイル使用メモリ | 64,680 KB |
実行使用メモリ | 25,220 KB |
平均クエリ数 | 31.43 |
最終ジャッジ日時 | 2024-07-16 20:13:50 |
合計ジャッジ時間 | 3,993 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <iostream> #include <stdio.h> #include <cstring> #include <math.h> #include <algorithm> #include <vector> #define rep(i,n) for(int i=0;i<n;i++) #define FOR(i,a,b) for(int i=a;i<b;i++) #define ll long long #define LL long long #define mass 1000000007 using namespace std; int main(){ int y1=1000000000; int sa; int y=500000000; int res; rep(i,100){ cout<<"? "<<y<<endl; cin>>res; sa=max(y1-y,y-y1)/2; if(sa<=1) break; y1=y; if(res){ y=sa+y; }else{ y=y-sa; } } //cout<<"この段階での "<<"res="<<res<<" y="<<y<<endl; //int t; //cin>>t; if(res){ while(res){ y++; cout<<"? "<<y<<endl; cin>>res; } y--; }else{ while(res==0){ y--; cout<<"? "<<y<<endl; cin>>res; } } cout<<"! "<<y<<endl; return 0; }