Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ──────▄▌▐▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▌
- ───▄▄██▌█░ВЕЗЕМ▄▀▀▀▄░ГУСЕЙ░░░░░░░
- ───████▌█▄███▀░◐░▄▀▀▀▄░░(РАБОТЯГИ)░
- ──██░░█▌█░░▄███▀░◐░░▄▀▀▀▄░░░░░░░
- ─██░░░█▌█░░░░▐░▄▀▀▀▌░░░░◐░▀███▄░
- ███████▌█▄███▀░◐░░░▌░░░░░▐░░░░░░
- ░██████▌█░░░░▌░░░░░▌░░░░░▐░░░░░░
- ███████▌█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▌
- ▀(@)▀▀▀▀▀▀▀(@)(@)▀▀▀▀▀▀▀▀▀▀▀▀▀(@)▀(@
- */
- /*
- ВЗГЛЯНИ ░ВОКРУГ,
- ░ОГЛЯНИСЬ░НАЗАД!
- ░ГУСИ░▄▀▀▀▄░С░ТОБОЮ░░░
- ░░░░▀░░░◐░▀███▄░░░░
- ░░░░▌░░░░░▐░░░░░░░
- ░░░░▐░░░░░▐░░░░░░░
- ░░░░▌░░░░░▐▄▄░░░░░
- ░░░░▌░░░░▄▀▒▒▀▀▀▀▄
- ░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
- ░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
- ░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
- ░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
- ░СВЯЗАТЬСЯ░░▌▌░▌▌░░░░░
- ░░░ХОТЯТ░░░░▌▌░▌▌░░░░░
- ░░░░░░░░░░░▄▄▌▌▄▌▌░░
- */
- /*
- ЗАПУСКАЕМ
- ░░◐░░◐░░░ХАЧИКУДЖИ░░░░░░░░░
- ░░▐░░▌░░░░░░▄▄▄▄░░░░░░░░░░░
- ░░▐░░▌░░░▄▀▀░▄▄▄▀▀▄░░░░░░░░
- ░░▐▄▄▌░▐▀░▐▀▀░▄░▀▌░▀▌░░░░░░
- ░▐░░░░▀▐░▐░░░▄▄▌░░▌░▀▌░░░░░
- ░░▀▌░░░▐▄░▀▀▀░░░▄▄▌░▄▌░░░░░
- ░░░░▀▄░░░▐▄▄▄▀▀▀░░▄▀░░░░░░░
- ░░░░░░▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀░░░░░
- */
- #include <iostream>
- #include <string>
- #include <sstream>
- #include <cmath>
- #include <algorithm>
- #include <memory.h>
- #include <stdio.h>
- #include <stack>
- #include <deque>
- #include <queue>
- #include <vector>
- #include <set>
- #include <iterator>
- #include <map>
- #include <iomanip>
- #include <unordered_set>
- #define int long long
- #define sp system("pause")
- #define pb push_back
- #define double long double
- #define endl "\n"
- #define un unsigned
- #define INF 1000000009
- #define pii pair<int, int>
- #define all(v) v.begin(), v.end()
- #define ll long long
- using namespace std;
- istream& operator >> (istream& in, vector<int>& a)
- {
- for (int i = 0; i < a.size(); i++)
- {
- in >> a[i];
- }
- return in;
- }
- ostream& operator << (ostream& out, vector<int>& a)
- {
- for (int i = 0; i < a.size(); i++)
- {
- out << a[i] << " ";
- }
- return out;
- }
- signed main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- string s;
- cin >> s;
- int n;
- cin >> n;
- int k = n;
- int a = 0;
- vector<int> st(64);
- st[0] = s.size();
- for (int i = 1; i < 64; i++)
- {
- st[i] = st[i - 1] * 2;
- }
- while (k > s.size())
- {
- int a = lower_bound(all(st), k) - st.begin();
- a = st[a];
- if (k < a / 2)
- {
- k /= 2;
- }
- else
- {
- k = k - a / 2 - 1;
- }
- if (k == 0)
- {
- k = a / 2;
- }
- }
- cout << s[k - 1];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement