結果

問題 No.305 鍵(2)
ユーザー femtofemto
提出日時 2016-08-12 00:23:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 688 bytes
コンパイル時間 613 ms
コンパイル使用メモリ 77,552 KB
実行使用メモリ 24,516 KB
平均クエリ数 94.23
最終ジャッジ日時 2023-09-23 11:18:44
合計ジャッジ時間 3,433 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 24 ms
23,532 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:35:30: 警告: ‘maxj’ may be used uninitialized [-Wmaybe-uninitialized]
   35 |                 ans[i] = '0' + maxj;
      |                          ~~~~^~~~~~
main.cpp:23:24: 備考: ‘maxj’ はここで定義されています
   23 |                 int n, maxj, maxn = -1;
      |                        ^~~~

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	string ans = "0000000000", res;
	int pn;

	cout << ans << endl;
	cout.flush();
	cin >> pn >> res;
	if(res == "unlocked") return 0;

	for(int i = 0; i < 10; i++) {
		int n, maxj, maxn = -1;
		for(int j = 0; j < 10; j++) {
			ans[i] = '0' + j;
			cout << ans << endl;
			cout.flush();
			cin >> n >> res;
			//if(res == "unlocked") return 0;
			if(maxn == -1 || maxn < n) {
				maxj = j;
				maxn = n;
			}
		}
		ans[i] = '0' + maxj;
	}

	cout << ans << endl;
	cout.flush();
}
0