StoneHaos

max16

May 25th, 2020
120
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main(void) {
  8.     unsigned short numb, tmp = 0;
  9.     cin >> numb;
  10.     numb >>= 8;
  11.     tmp = numb;
  12.     for (int i = 0; i < 8; ++ i) {
  13.         numb <<= 1;
  14.         numb |= tmp & 1;
  15.         tmp >>= 1;
  16.     }
  17.     cout << numb << "\n";
  18.     return 0;
  19. }
  20.  
  21. /*
  22. 1100 0111 0011 0100 (50996) => 1100 0111 1110 0011 (51171)
  23. 1010 1001 1111 0000 (43504) => 1010 1001 1001 0101 (43413)
  24. */
RAW Paste Data