Advertisement
StoneHaos

test2

Oct 29th, 2019
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. //test2
  2. #include <iostream>
  3. #include <vector>
  4. #include <algorithm>
  5. using namespace std;
  6.  
  7. int main(void) {
  8.     freopen("input.txt", "r", stdin);
  9.     freopen("output.txt", "w", stdout);
  10.     int n;
  11.     vector<int> a(0);
  12.     cin >> n;
  13.     while (n != 0) {
  14.         a.push_back(n % 2);
  15.         n >>= 1;
  16.     }
  17.     reverse(a.begin(), a.end());
  18.     for (int i = 0; i < a.size(); ++ i)
  19.         cout << a[i];
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement