結果
| 問題 | No.253 ロウソクの長さ |
| コンテスト | |
| ユーザー |
fiord
|
| 提出日時 | 2015-07-25 00:32:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 579 bytes |
| 記録 | |
| コンパイル時間 | 1,927 ms |
| コンパイル使用メモリ | 159,412 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 73.03 |
| 最終ジャッジ日時 | 2024-07-16 05:07:10 |
| 合計ジャッジ時間 | 6,270 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int ask(int y){
cout<<"? "<<y<<endl;
int ans;
cin>>ans;
return ans;
}
int main(){
int ple=100;
int left=1e9,right=10;
int cnt=0;
for(;cnt<10;cnt++){
int ans=ask((ple+right)/2);
if(ans==0){
printf("!%d\n",(ple+right)/2+cnt);
return 0;
}
else if(ans==1) right=(ple+right)/2;
else ple=(ple+right)/2;
}
right=10;
for(;cnt<100;cnt++){
int ans=ask((left+right)/2);
if(ans==0){
printf("!%d\n",(left+right)/2+cnt);
return 0;
}
else if(ans==1) right=(left+right)/2;
else left=(left+right)/2;
}
}
fiord