0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-28 15:51:57 +00:00

P3612 [USACO17JAN]Secret Cow Code S

R44593297
This commit is contained in:
Baoshuo Ren 2021-01-03 21:31:10 +08:00 committed by Baoshuo Ren
parent ec9fe743da
commit 7ef2844a8e
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,20 @@
#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;
}