Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
435505 王程之 26年1月-A组(萌新)D. 密码 C++ 通过 100 6 MS 312 KB 628 2026-04-06 15:23:30

Tests(10/10):


#include <iostream> #include <string> using namespace std; int main() { string s, t; cin >> s >> t; string res(s.size(), 'Z'); int n = s.size(), m = t.size(); for (int i = 0; i <= n - m; i++) { string now = s; bool f = 1; for (int j = 0; j < m; j++) { if (now[i+j] != '?' && now[i+j] != t[j]) { f = 0; break; } now[i+j] = t[j]; } if (!f) continue; for (char &c : now) if (c == '?') c = 'A'; if (now < res) res = now; } cout << res << endl; return 0; }


测评信息: