Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<bits/stdc++.h>
- #define ll long long
- using namespace std;
- void Base(int n){
- if (n == 0)
- return;
- int x = n % 2;
- n /= 2;
- if (x < 0)
- n += 1;
- Base(n);
- cout<< (x < 0 )? 1 : 0;
- return;
- }
- int main() {
- ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
- int t; cin>>t;
- while (t--){
- int n; cin>>n;
- if (n != 0)
- {
- Base(n);
- cout<<endl;
- }
- else
- cout<<"0"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement