結果
問題 | No.305 鍵(2) |
ユーザー | data9824 |
提出日時 | 2016-02-01 01:04:55 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 611 bytes |
コンパイル時間 | 1,347 ms |
コンパイル使用メモリ | 53,772 KB |
実行使用メモリ | 24,372 KB |
平均クエリ数 | 86.69 |
最終ジャッジ日時 | 2023-09-23 23:08:14 |
合計ジャッジ時間 | 1,890 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 27 ms
23,652 KB |
testcase_01 | AC | 22 ms
24,036 KB |
testcase_02 | AC | 22 ms
24,360 KB |
testcase_03 | AC | 22 ms
23,208 KB |
testcase_04 | AC | 22 ms
24,300 KB |
testcase_05 | AC | 22 ms
23,652 KB |
testcase_06 | AC | 19 ms
24,000 KB |
testcase_07 | AC | 25 ms
23,640 KB |
testcase_08 | AC | 25 ms
23,604 KB |
testcase_09 | AC | 29 ms
23,652 KB |
testcase_10 | AC | 24 ms
23,508 KB |
testcase_11 | AC | 22 ms
24,372 KB |
testcase_12 | AC | 22 ms
24,324 KB |
ソースコード
#include <iostream> #include <string> using namespace std; int main() { string key; for (int i = 0; i < 10; ++i) { int maxMatched = 0; int maxDigit = 0; for (int k = 0; k < 10; ++k) { string challenge = key; challenge.push_back('0' + k); if (key.size() < 9) { challenge.append(string(9 - key.size(), '0')); } cout << challenge << endl; int matched; string locked; cin >> matched >> locked; if (locked == "unlocked") { return 0; } if (matched > maxMatched) { maxDigit = k; maxMatched = matched; } } key.push_back('0' + maxDigit); } return 0; }