Advertisement
Rucard

Katy_2

Feb 27th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  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.    
  13.     int k;
  14.     scanf("%i",&k);
  15.  
  16.         for (int i = 0; i < n; i++) {
  17.             unsigned short num = 0;
  18.             unsigned short num_2 = 1;
  19.             num_2 = (num_2 << (16 - k));
  20.             num = num | num_2;
  21.             for (int g = 0; g < 16; g++) {
  22.                 unsigned short num_2 = 1;
  23.                 num_2 = (num_2 << (15 - g));
  24.                 num_2 = num & num_2;
  25.                 if (((num_2 << g) >> 15) == 1)
  26.                     printf("1");
  27.                 else
  28.                     printf("0");
  29.             }
  30.             printf("\n");
  31.         }
  32.    
  33.     _getch();
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement