結果

問題 No.305 鍵(2)
ユーザー hotpepsihotpepsi
提出日時 2015-11-30 00:25:18
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 542 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 61,220 KB
実行使用メモリ 24,384 KB
平均クエリ数 63.08
最終ジャッジ日時 2023-09-23 08:11:46
合計ジャッジ時間 2,260 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,856 KB
testcase_01 WA -
testcase_02 AC 26 ms
23,772 KB
testcase_03 AC 26 ms
24,000 KB
testcase_04 WA -
testcase_05 AC 28 ms
23,928 KB
testcase_06 WA -
testcase_07 AC 28 ms
23,532 KB
testcase_08 AC 26 ms
24,276 KB
testcase_09 WA -
testcase_10 AC 27 ms
24,324 KB
testcase_11 AC 26 ms
24,012 KB
testcase_12 AC 28 ms
23,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>

using namespace std;

int getres(const char *w) {
	printf("%s\n", w);
	fflush(stdout);
	char buff[1024];
	fgets(buff, 1024, stdin);
	return atoi(buff);
}

int main(int argc, char *argv[])
{
	char w[16] = "0000000000";
	int a = getres(w);
	for (int i = 0; i < 10; ++i) {
		for (int j = 0; j < 10; ++j) {
			w[i] = '0' + j;
			int b = getres(w);
			if (b < a) {
				w[i] = '0' + j - 1;
				break;
			}
			if (b > a) {
				a = b;
				break;
			}
		}
	}
	return 0;
}
0