結果

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

テストケース

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

	cout << ans << endl;
	cin >> n >> res;

	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;
			cin >> n >> res;
			if(maxn == -1 || maxn < n) {
				maxj = j;
				maxn = n;
			}
		}
		ans[i] = '0' + maxj;
	}

	cout << ans << endl;
}
0