結果

問題 No.2226 Hello, Forgotten World!
ユーザー Manuel1024Manuel1024
提出日時 2023-12-27 21:12:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 738 bytes
コンパイル時間 735 ms
コンパイル使用メモリ 68,284 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-27 21:12:44
合計ジャッジ時間 1,699 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0