求帮助!

P3612 [USACO17JAN] Secret Cow Code S

a15207081682 @ 2024-05-08 22:52:02

using namespace std;
string s,b;
long long n;

int main(){

    cin>> s >> n;
    long long len=s.length();
    while(n>len){
        s+=s[len-1]; 
        for(long long i=0;i<len-2;i++){
            b+=s[i];
        }
        s+=b;
        len*=2;
    }
    cout<< s[n-1];

    return 0;
}

|