Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sstream>
- #include <iostream>
- #include <stdio.h>
- #include <conio.h>
- using namespace std;
- int main()
- {
- int n;
- scanf("%i",&n);
- int *mas = new int[n];
- for (int i = 0; i < n; i++) {
- scanf("%i",&mas[i]);
- }
- unsigned short num = 0;
- for (int i = 0; i < n; i++) {
- if (mas[i]%2 == 0) {
- unsigned short num_1 = 1;
- num_1 = (num_1 << (15 - i));
- num = (num | num_1);
- }
- }
- for (int i = 0; i < n; i++) {
- unsigned short num_2 = 1;
- num_2 = (num_2 << (15 - i));
- num_2 = num & num_2;
- if (((num_2 << i) >> 15) == 1)
- printf("1");
- else
- printf("0");
- }
- printf("\n");
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement