这都能MLE?我傻了啊
  • 板块P1885 Moo
  • 楼主孙cy
  • 当前回复5
  • 已保存回复5
  • 发布时间2020/7/27 09:26
  • 上次更新2023/11/6 22:09:18
查看原帖
这都能MLE?我傻了啊
195670
孙cy楼主2020/7/27 09:26
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main()
{
    int n;
    cin >> n;
    string str0,str1;
    str0 = "moo";
    str1 = "moo";
    int i = 0;
    while (str1.length() < n)
    {
        i++;
        string temp = "";
        for (int j = 0; j < i + 2; j++)
            temp += "o";
        str1 = str0 + "m" + temp + str0;
        str0 = str1;
    }
    cout << str1[n - 1] << endl;
    return 0;
}
2020/7/27 09:26
加载中...