結果

問題 No.305 鍵(2)
ユーザー dgd1724dgd1724
提出日時 2016-10-22 11:27:45
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 816 bytes
コンパイル時間 2,056 ms
コンパイル使用メモリ 145,148 KB
実行使用メモリ 24,324 KB
平均クエリ数 34.46
最終ジャッジ日時 2023-09-24 00:39:44
合計ジャッジ時間 2,640 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,340 KB
testcase_01 AC 25 ms
24,264 KB
testcase_02 AC 20 ms
24,324 KB
testcase_03 AC 22 ms
23,640 KB
testcase_04 AC 22 ms
23,184 KB
testcase_05 AC 20 ms
24,024 KB
testcase_06 AC 20 ms
23,904 KB
testcase_07 AC 22 ms
23,628 KB
testcase_08 AC 20 ms
23,748 KB
testcase_09 AC 21 ms
23,796 KB
testcase_10 AC 21 ms
23,616 KB
testcase_11 AC 21 ms
23,496 KB
testcase_12 AC 22 ms
24,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

//const static double	de_PI	= 3.14159265358979323846;
//const static int	de_MOD	= 1000000007;
//const static int	de_MAX	= 999999999;
//const static int	de_MIN = -999999999;

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());

	std::string ans = "0000000000", result;
	int before = -1, now = -1, i = 0;

	while (1) {
		std::cout << ans << std::endl;
		std::cin >> now >> result;

		if (result == "unlocked") { return 0; }
		
		if (before == -1) {
			if (now == 0) {
				for (int j = 0; j < 10; j++) {
					ans[j]++;
				}
				continue;
			}

			before = now;
			ans[i]++;
			continue;
		}

		if (before < now) {
			i++;
			before = now;
			ans[i]++;
			continue;
		}

		if (before > now) {
			ans[i]--;
			i++;
			ans[i]++;
			continue;
		}

		ans[i]++;
	
	}
	
}

0