結果

問題 No.305 鍵(2)
ユーザー hanorverhanorver
提出日時 2015-11-27 22:51:41
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 623 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 52,240 KB
実行使用メモリ 24,252 KB
平均クエリ数 46.15
最終ジャッジ日時 2023-09-23 06:45:11
合計ジャッジ時間 2,398 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
23,688 KB
testcase_01 WA -
testcase_02 AC 28 ms
23,580 KB
testcase_03 AC 27 ms
24,204 KB
testcase_04 WA -
testcase_05 AC 30 ms
24,036 KB
testcase_06 AC 27 ms
23,460 KB
testcase_07 AC 31 ms
23,556 KB
testcase_08 AC 29 ms
23,820 KB
testcase_09 WA -
testcase_10 AC 28 ms
23,808 KB
testcase_11 AC 28 ms
24,024 KB
testcase_12 AC 31 ms
23,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>

void print(int pass[]) {
	for (int i = 0; i < 10; i++) {
		std::cout << pass[i];
	}
	std::cout << std::endl;
}

int main() {
	int pass[] = {0,0,0,0,0,0,0,0,0,0};
	int ans = 0;
	std::string s;

	print(pass);
	std::cin >> ans >> s;

	while (ans != 10) {
		for (int i = 0; i < 10; i++) {
			for (int j = 1; j < 10; j++) {
				int tmp;
				std::string stmp;
				pass[i] = j;
				print(pass);
				std::cin >> tmp >> stmp;
				if (stmp == "10") return 0;
				if (tmp > ans) {
					ans = tmp;
					break;
				}
				if (tmp < ans) {
					pass[i] -= 1;
					break;
				}
			}
		}
	}
	return 0;
}
0