結果
問題 | No.2226 Hello, Forgotten World! |
ユーザー |
|
提出日時 | 2023-02-24 21:34:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 1,106 bytes |
コンパイル時間 | 605 ms |
コンパイル使用メモリ | 69,556 KB |
最終ジャッジ日時 | 2025-02-10 20:37:03 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#include <iostream> using namespace std; string hello = "helloworld"; int main() { int t; cin >> t; while (t--) { int n; string s; cin >> n >> s; string ans = "{"; for (int i = 0; i < n - 9; i++) { bool f = true; for (int j = 0; j < 10; j++) { if (s[i + j] != '?' && s[i + j] != hello[j]) { f = false; break; } } if (f) { string t = s; for (int j = 0; j < n; j++) { if (t[j] == '?') { t[j] = 'a'; } } for (int j = 0; j < 10; j++) { t[i + j] = hello[j]; } ans = min(ans, t); } } if (ans == "{") { cout << -1 << endl; } else { cout << ans << endl; } } }