結果

問題 No.1187 皇帝ペンギン
ユーザー square1001
提出日時 2020-08-22 14:26:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 1,000 ms
コード長 360 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 65,288 KB
実行使用メモリ 25,324 KB
平均クエリ数 16.87
最終ジャッジ日時 2024-07-17 06:17:54
合計ジャッジ時間 4,695 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <string>
#include <iostream>
using namespace std;
string ask(int x) {
	cout << "? " << x << endl;
	string str;
	cin >> str;
	return str;
}
int main() {
	int l = 0, r = 1024;
	while (r - l > 1) {
		int m = (l + r) >> 1;
		if (ask(m) == "out" && ask(m + 1) == "out") {
			r = m;
		}
		else {
			l = m;
		}
	}
	cout << "! " << r - 1 << endl;
	return 0;
}
0