結果
| 問題 |
No.305 鍵(2)
|
| コンテスト | |
| ユーザー |
MJDigit
|
| 提出日時 | 2015-11-29 20:30:36 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 1,423 bytes |
| コンパイル時間 | 564 ms |
| コンパイル使用メモリ | 59,864 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 34.38 |
| 最終ジャッジ日時 | 2024-07-16 21:56:29 |
| 合計ジャッジ時間 | 1,851 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
const int digits = 10;
int n[10];
int ans[digits] = {};
int matched[digits] = {};
int maxmatch;
string rep;
for (int i = 0; i < 10; i++) {
for (int digit = 0; digit < digits; digit++) {
cout << i;
}
cout << endl;
cin >> n[i] >> rep;
if(rep == "unlocked") {
return 0;
}
}
for (int i = 1; i < 10; i++) {
if (n[i] == 0) {
continue;
}
maxmatch = 0;
for (int j = 0; j < digits; j++) {
if (ans[j] != 0) {
continue;
}
for (int digit = 0; digit < digits; digit++) {
if (digit == j) {
cout << i;
} else {
cout << ans[digit];
}
}
cout << endl;
cin >> matched[j] >> rep;
if(rep == "unlocked") {
return 0;
}
maxmatch = max (matched[j], maxmatch);
}
for (int j = 0; j < digits; j++) {
if (matched[j] == maxmatch) {
ans[j] = i;
}
matched[j] = 0;
}
}
for (int digit = 0; digit < digits; digit++) {
cout << ans[digit];
}
cout << endl;
return 0;
}
MJDigit