Advertisement
MatveyL

123

Dec 10th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. using namespace std;
  5. vector<int>nums;
  6. int kek;
  7. int cheak1;
  8. int cheak2;
  9. int g =0;
  10.  
  11. int fak(int a, int b){
  12. for (int i = 0; i < b; ++i){
  13. a = 2 * a;
  14. }
  15. return a;
  16. }
  17. int fuck(int a, int y = kek, int pro = 0){
  18. if (cheak1 == cheak2){
  19. cheak2 = 0;
  20. return 9;
  21. }
  22. if(a<=y/2){
  23. nums.push_back(0);
  24. cheak2+=1;
  25. fuck(a,y/2);
  26. return 9;
  27. }
  28. else{
  29. nums.push_back(1);
  30. cheak2+=1;
  31. fuck(a/2,y/2);
  32. return 9;
  33. }
  34. }
  35. int main() {
  36. int a,b,l;
  37. cin>>a;
  38. l = 0;
  39. cheak1=a;
  40. kek = fak(1,a);
  41. for(int i = 0; i < kek/2; ++i){
  42. fuck(i+1);
  43. g = 0;
  44. }
  45. for(int i = 0; i < kek/2; i++){
  46. l+=a;
  47. nums.push_back(1);
  48. for(int j = 0; j < a -1;++j){
  49. nums.push_back(nums[l-a+1+j]);
  50. }
  51.  
  52. }
  53. l = 0;
  54. for(int i = 0; i < nums.size()/3; i++){
  55. l+=a;
  56. for(int j = 0; j < a;++j){
  57. cout<<nums[l-a+j]<<" ";
  58. }
  59. cout<<"\n";
  60. }
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement