Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <queue>
- #include <iostream>
- #include <vector>
- #include <cstring>
- #include <iostream>
- //#include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- int main() {
- ll n, k;
- cin >> n >> k;
- string res = "";
- while(n > 0) {
- ll mid = (1LL << (n - 1));
- if(k <= mid) {
- res += "0";
- }
- else {
- res += "1";
- k = (1LL << n) - k + 1;
- }
- n--;
- }
- cout << res << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement