SHARE
TWEET

Katy

Rucard Feb 27th, 2020 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <sstream>
  2. #include <iostream>
  3. #include <stdio.h>
  4. #include <conio.h>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.    
  10.     int n;
  11.     scanf("%i",&n);
  12.     int *mas = new int[n];
  13.     for (int i = 0; i < n; i++) {
  14.         scanf("%i",&mas[i]);
  15.     }
  16.     unsigned short num = 0;
  17.  
  18.     for (int i = 0; i < n; i++) {
  19.         if (mas[i]%2 == 0) {
  20.             unsigned short num_1 = 1;
  21.             num_1 = (num_1 << (15 - i));
  22.             num = (num | num_1);
  23.         }
  24.     }
  25.    
  26.         for (int i = 0; i < n; i++) {
  27.             unsigned short num_2 = 1;
  28.             num_2 = (num_2 << (15 - i));
  29.             num_2 = num & num_2;
  30.             if (((num_2 << i) >> 15) == 1)
  31.                 printf("1");
  32.             else
  33.                 printf("0");
  34.         }
  35.         printf("\n");
  36.    
  37.     _getch();
  38.     return 0;
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top