結果

問題 No.2925 2-Letter Shiritori
ユーザー masa
提出日時 2024-10-12 16:05:17
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 4,567 ms
コンパイル使用メモリ 126,572 KB
実行使用メモリ 25,196 KB
平均クエリ数 26.00
最終ジャッジ日時 2024-10-12 16:05:24
合計ジャッジ時間 2,505 ms
ジャッジサーバーID
(参考情報)
judge2 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <tuple>
#include <set>
#include <map>
#include <cassert>

using namespace std;

string query(char c1, char c2) {
	cout << "? " << c1 << c2 << endl;
	char c;
	string t;

	cin >> c >> t;

	// fprintf(stderr, "c %c, t '%s'\n", c, t.c_str());

	if (c == '!') {
		return "";
	} else {
		return t;
	}
}


int main() {
	char alpha;
	cin >> alpha;

	string ret = query(alpha, alpha);

	while (ret.size()> 0) {
		ret = query(ret[1], ret[0]);
	}

	return 0;
}
0