結果
問題 |
No.2226 Hello, Forgotten World!
|
ユーザー |
![]() |
提出日時 | 2023-12-27 21:12:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 738 bytes |
コンパイル時間 | 685 ms |
コンパイル使用メモリ | 69,400 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-27 15:34:42 |
合計ジャッジ時間 | 1,442 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 9 |
ソースコード
#include <iostream> #include <vector> #include <string> using namespace std; void solve(int n, string s){ const string hello = "helloworld"; for(int i = n-10; i >= 0; i--){ bool isok = true; for(int j = 0; j < 10; j++){ if(!(s[i+j] == '?' || s[i+j] == hello[j])) isok = false; } if(isok){ for(int j = 0; j < 10; j++) s[i+j] = hello[j]; for(int j = 0; j < n; j++){ if(s[j] == '?') s[j] = 'a'; } cout << s << '\n'; return; } } cout << -1 << '\n'; } int main(){ int t; cin >> t; while(t--){ int n; cin >> n; string s; cin >> s; solve(n, s); } return 0; }