結果

問題 No.1187 皇帝ペンギン
ユーザー 👑 CleyL
提出日時 2022-02-16 00:27:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 23 ms / 1,000 ms
コード長 494 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 65,680 KB
実行使用メモリ 25,424 KB
平均クエリ数 16.44
最終ジャッジ日時 2024-06-29 07:10:23
合計ジャッジ時間 4,061 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
    int mn = 0;
    int mx = 1001;
    while(mx-mn > 1){
        int ce = (mn+mx)/2;
        cout << "? " << ce << endl;
        string s;cin>>s;
        if(s == "safe"){
            mn = ce;
        }else{
            cout << "? " << ce+1 << endl;
            cin>>s;
            if(s == "safe"){
                mn = ce+1;
            }else{
                mx = ce;
            }
        }
        
    }
    cout << "! " << mn << endl;
}
0