結果

問題 No.305 鍵(2)
ユーザー hanorverhanorver
提出日時 2016-05-18 09:31:42
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 1,976 ms
コンパイル使用メモリ 52,768 KB
実行使用メモリ 24,348 KB
平均クエリ数 53.08
最終ジャッジ日時 2023-09-23 23:53:31
合計ジャッジ時間 1,630 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,436 KB
testcase_01 AC 25 ms
23,652 KB
testcase_02 AC 23 ms
24,012 KB
testcase_03 AC 23 ms
23,820 KB
testcase_04 AC 25 ms
23,388 KB
testcase_05 AC 26 ms
23,436 KB
testcase_06 AC 22 ms
23,388 KB
testcase_07 AC 24 ms
23,580 KB
testcase_08 AC 24 ms
24,060 KB
testcase_09 AC 24 ms
23,400 KB
testcase_10 AC 24 ms
24,348 KB
testcase_11 AC 24 ms
23,436 KB
testcase_12 AC 25 ms
23,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<cctype>

int main() {
	std::string ans = "0000000000";
	std::cout << ans << std::endl;
	int ans_num;
	std::string result;
	std::cin >> ans_num >> result;
	if (result == "unlocked") return 0;

	int prev_ans = ans_num;
	for (int i = 0; i < ans.size(); i++) {
		for (int j = 0; j < 10; j++) {
			ans[i] = '0' + j;
			std::cout << ans << std::endl;
			std::cin >> ans_num >> result;

			if (result == "unlocked") return 0;
			if (ans_num > prev_ans) {
				prev_ans = ans_num;
				break;
			}
			if (ans_num < prev_ans) {
				ans[i] = '0' + (j - 1);
				break;
			}
		}
	}
}
0