結果
| 問題 |
No.305 鍵(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-28 03:07:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 2,000 ms |
| コード長 | 966 bytes |
| コンパイル時間 | 595 ms |
| コンパイル使用メモリ | 64,628 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 52.15 |
| 最終ジャッジ日時 | 2024-07-16 21:53:22 |
| 合計ジャッジ時間 | 1,978 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
// Drinking programming is so fun, isn't it?
int main() {
int pin[10] = { 0 };
int corrected = -1;
for (int i = 0; i < 10;i++) { // for each pin code digit
for (int j = 0; j < 10;j++) { // for each numeric
pin[i] = j;
// output
for (int k = 0; k < 10; k++) cout << pin[k]; cout << endl;
// input
int responce1;
string responce2;
cin >> responce1 >> responce2;
// check
if (corrected == -1) corrected = responce1; // initial round
if (responce1 == 10 || responce2 == "unlocked") {
return 0; // mission completed :D
} else if (responce1 > corrected) {
corrected = responce1;
break; // to next digit
} else if (responce1 < corrected) {
pin[i] = j - 1;
corrected = responce1 + 1;
break; // to next digit
} else {
corrected = responce1;
}
}
}
}