0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 08:38:49 +00:00
OI-codes/Luogu/problem/P3612/P3612.cpp
2021-01-03 21:31:10 +08:00

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;
}