結果

問題 No.1187 皇帝ペンギン
ユーザー betrue12
提出日時 2020-09-01 03:48:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 43 ms / 1,000 ms
コード長 349 bytes
コンパイル時間 2,957 ms
コンパイル使用メモリ 192,260 KB
最終ジャッジ日時 2025-01-14 02:50:01
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

bool angry(int N){
    cout << "? " << N << endl;
    string s;
    cin >> s;
    return (s == "out");
}

int main(){
    int ok = 0, ng = 1000;
    while(ng-ok>1){
        int mid = (ng+ok)/2;
        (angry(mid) && angry(mid+1) ? ng : ok) = mid;
    }
    cout << "! " << ok << endl;
    return 0;
}
0