90分#9 MLE求助
查看原帖
90分#9 MLE求助
576378
creation_hy楼主2022/7/28 12:32

我看了下测试点,都是常规数据,没有毒瘤啊

卡在这个点了,125MB MLE

[2[2[2[2[2[2[2[2[2[2YEAH]]]]]]]]]]

#include<bits/stdc++.h>
using namespace std;
string f() {
    string res = "", s;
    int n;
    for (char c = getchar(); c != '\n'; c = getchar())
        if (c == '[') {
            cin >> n;
            s = f();
            while (n--)res += s;
        } else if (c == ']')return res;
        else res += c;
    return res;
}
int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    //cout.tie(nullptr);
    cout << f();
    return 0;
}
2022/7/28 12:32
加载中...