結果
問題 | No.305 鍵(2) |
ユーザー |
|
提出日時 | 2020-04-13 22:00:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 666 bytes |
コンパイル時間 | 580 ms |
コンパイル使用メモリ | 67,784 KB |
最終ジャッジ日時 | 2025-01-09 18:14:09 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
ソースコード
#include <iostream>#include <string>int query(const std::string& s) {std::cout << s << std::endl;int x;std::string t;std::cin >> x >> t;if (x == 10) std::exit(0);return x;}void solve() {std::string s(10, '0');for (int i = 0; i < 10; ++i) {int x = -1, max = -1;for (int c = 0; c <= 9; ++c) {s[i] = '0' + c;int res = query(s);if (res > max) {max = res;x = c;}}s[i] = '0' + x;}}int main() {std::cin.tie(nullptr);std::ios::sync_with_stdio(false);solve();return 0;}