Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- using namespace std;
- typedef unsigned long long ll;
- int main()
- {
- string str = "0";
- ll a, b;
- cin >> a >> b;
- while(b != 1)
- {
- if(a > ((1 << (b - 1))))
- {
- str += '1';
- a = (1 << b) - a;
- continue;
- }
- else
- {
- str += '0';
- --b;
- continue;
- }
- }
- cout << str << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement