求调qwq

P3612 [USACO17JAN] Secret Cow Code S

All_Failed_OI_Cici @ 2024-07-24 23:09:37

所以哪儿错了呢?

#include<bits/stdc++.h>
using namespace std;
long long n;
string s,str;
char c;
int main(){
    cin>>s>>n;
    str=s;
    long long y=s.size();
    for(long long i=1;i<=(long long)ceil(n/y);i++){
        str=s;
        long long x=s.size()-1;
        c=str[x];
        str.erase(x,1);
        s=s+c+str;
        cout<<s<<endl;
    }
    cout<<s[n-1];
    return 0;
}

提示:
不知道哪里死循环了,thx!
1.\color{green}AC一个点;
2.\color{purple}RE四个点;
3.\color{darkblue}MLE五个点;

谢谢!


by zqw1234 @ 2024-07-25 06:37:31

str = 啥?


by zqw1234 @ 2024-07-25 06:38:27

不对,是s = 啥?


|