#3WA!

P3612 [USACO17JAN] Secret Cow Code S

xingyu671 @ 2023-07-30 21:36:20

#include<iostream>
//#include<cmath>
#include<string>
//#include<cstring>
//#include<cstdio>
//#include<algorithm>
using namespace std;
int main(void)
{
    long long n;
    string s;
    cin >> s >> n;
    long long len = s.size();
    while(len < n)
    {
        long long t = len;
        while(n > t) t *= 2;
        n -= t/2+1; 
        if(!n) n = t;
    }
    cout << s[n-1];
    return 0;
}

by xingyu671 @ 2023-07-30 21:42:58

已过。


|