0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-25 19:12:02 +00:00
OI-codes/Luogu/P3612/P3612.cpp

20 lines
336 B
C++

#include <bits/stdc++.h>
using namespace std;
long long l, n, t;
char s[55];
int main() {
scanf("%s%lld", s + 1, &n);
l = t = strlen(s + 1);
while (t < n) {
t <<= 1;
}
while (t != l) {
t >>= 1;
n = n > t ? ((t + 1 != n) ? n - 1 - t : t) : n;
}
printf("%c\n", s[n]);
return 0;
}