結果
| 問題 | 
                            No.1187 皇帝ペンギン
                             | 
                    
| コンテスト | |
| ユーザー | 
                             akane
                         | 
                    
| 提出日時 | 2020-08-22 17:27:40 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 37 ms / 1,000 ms | 
| コード長 | 655 bytes | 
| コンパイル時間 | 2,320 ms | 
| コンパイル使用メモリ | 193,428 KB | 
| 最終ジャッジ日時 | 2025-01-13 10:38:28 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 54 | 
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i < (n); i++)
using namespace std;
using ll = long long;
int main(){
    ios::sync_with_stdio(false);
    int safe = 0, out=1000;
    int t=25;
    while(t--){
        int c = (safe+out)/2;
        cout << "? " << c << endl;
        string s; cin >> s;
        if(s=="safe"){
            safe = c;
        }else if(s=="out"){
            if(t==0) break;
            t--;
            cout << "?" << c+1 << endl;
            cin >> s;
            if(s=="out"){
                out = c;
            }else{
                safe = c+1;
            }
        }
    }
    cout << "! " << safe << endl;
}
            
            
            
        
            
akane