結果

問題 No.253 ロウソクの長さ
ユーザー latte0119latte0119
提出日時 2015-08-06 12:59:45
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 590 bytes
コンパイル時間 1,130 ms
コンパイル使用メモリ 143,468 KB
実行使用メモリ 24,348 KB
平均クエリ数 33.94
最終ジャッジ日時 2023-09-23 05:39:45
合計ジャッジ時間 4,151 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,156 KB
testcase_01 AC 27 ms
24,300 KB
testcase_02 AC 27 ms
24,036 KB
testcase_03 AC 26 ms
23,628 KB
testcase_04 AC 26 ms
24,348 KB
testcase_05 AC 27 ms
23,856 KB
testcase_06 AC 26 ms
23,676 KB
testcase_07 AC 26 ms
23,856 KB
testcase_08 AC 26 ms
24,048 KB
testcase_09 AC 25 ms
23,400 KB
testcase_10 AC 26 ms
24,012 KB
testcase_11 AC 26 ms
23,412 KB
testcase_12 AC 26 ms
24,036 KB
testcase_13 AC 25 ms
24,036 KB
testcase_14 AC 25 ms
24,048 KB
testcase_15 AC 26 ms
24,048 KB
testcase_16 AC 25 ms
23,412 KB
testcase_17 AC 26 ms
24,312 KB
testcase_18 AC 25 ms
23,436 KB
testcase_19 AC 25 ms
23,844 KB
testcase_20 AC 25 ms
24,024 KB
testcase_21 AC 26 ms
24,036 KB
testcase_22 AC 25 ms
23,844 KB
testcase_23 AC 26 ms
23,640 KB
testcase_24 AC 27 ms
23,844 KB
testcase_25 AC 25 ms
24,048 KB
testcase_26 AC 25 ms
24,348 KB
testcase_27 AC 25 ms
24,336 KB
testcase_28 AC 25 ms
23,568 KB
testcase_29 AC 26 ms
24,324 KB
testcase_30 AC 26 ms
23,652 KB
testcase_31 AC 25 ms
24,048 KB
testcase_32 AC 25 ms
23,544 KB
testcase_33 WA -
testcase_34 AC 25 ms
23,436 KB
testcase_35 AC 26 ms
24,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0