結果
問題 |
No.355 数当てゲーム(2)
|
ユーザー |
|
提出日時 | 2017-01-26 12:57:29 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 23 ms / 2,000 ms |
コード長 | 969 bytes |
コンパイル時間 | 1,442 ms |
コンパイル使用メモリ | 163,892 KB |
実行使用メモリ | 25,616 KB |
平均クエリ数 | 38.92 |
最終ジャッジ日時 | 2024-07-17 00:47:01 |
合計ジャッジ時間 | 5,009 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); vector<int> data = {9, 8, 7, 6}; vector<int> known; for (int i = 0; i < 4; i++) { int xy = -1; int know = data.back(); int limit = data.back(); for (int num = 0; num <= limit; num++) { if (find(known.begin(), known.end(), num) != known.end()) continue; data.back() = num; for (int idx = 0; idx < 4; idx++) { cout << data[idx]; if (idx == 3) cout << endl; else cout << " "; } int X, XY; cin >> X >> XY; if (X == 4) return 0; XY += X; if (xy < XY) { xy = XY; know = num; } } data.pop_back(); data.insert(data.begin(), know); known.push_back(know); } do { for (int idx = 0; idx < 4; idx++) { cout << known[idx]; if (idx == 3) cout << endl; else cout << " "; } int X, Y; cin >> X >> Y; if (X == 4) break; } while (next_permutation(known.begin(), known.end())); return 0; }