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:
parent
ec9fe743da
commit
7ef2844a8e
20
Luogu/problem/P3612/P3612.cpp
Normal file
20
Luogu/problem/P3612/P3612.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user