fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. string bin(long long n)
  4. {
  5. string s;
  6. while(n)
  7. {
  8. if(n%2==1)
  9. s.push_back('1');
  10. else
  11. s.push_back('0');
  12. n=n/2;
  13. }
  14. return s;
  15. }
  16. int main()
  17. {
  18. std::ios_base::sync_with_stdio(NULL);
  19. cin.tie(NULL);
  20. cout.tie(NULL);
  21. long long n;
  22. string k;
  23. cin>>n;
  24. k=bin(n);
  25. reverse(k.begin(),k.end());
  26. cout<<k;
  27. return 0;
  28. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1010110001101011011010100011110101101111001001