Facebook
From AGG, 6 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 270
  1. #include "stdafx.h"
  2. #include <vector>
  3. #include <iostream>
  4. #include <thread>
  5. #include <atomic>
  6. #include <array>
  7.  
  8. std::array<std::atomic<int>, 100> Kolumny{};
  9. std::vector<std::vector<bool>> Mac;
  10. std::vector<std::vector<bool>> draw(int);
  11. int main()
  12. {
  13.         int x;
  14.         std::cin >> x;
  15.         Mac = draw(x);
  16.  
  17.  
  18.     return 0;
  19. }
  20.  
  21. std::vector<std::vector<bool>> draw(int x)
  22. {
  23.         std::vector<std::vector<bool>> Mac(x, std::vector<bool>(x));
  24.         int i=0, j = 0;
  25.         while (i < x)
  26.         {
  27.                 while (j < x - i)
  28.                 {
  29.                         if (i == j) Mac[i][j] = false;
  30.                         else
  31.                         {
  32.                                 if (rand() % 3)
  33.                                 {
  34.                                         Mac[i][j] = true;
  35.                                         Mac[j][i] = true;
  36.                                 }
  37.                                 else
  38.                                 {
  39.                                         Mac[i][j] = false;
  40.                                         Mac[j][i] = false;
  41.                                 }
  42.                         }
  43.                         j++;
  44.                 }
  45.                 i++; j = 0;
  46.         }
  47.        
  48.         for(int i=0; i<x; i++)
  49.         {
  50.                 for (int j = 0; j < x; j++)
  51.                 {
  52.                         if (Mac[i][j]) std::cout << "1 ";
  53.                         else std::cout << "0 ";
  54.                 }
  55.                 std::cout << std::endl;
  56.         }
  57.  
  58.  
  59.         return Mac;
  60. }
  61.  
  62. void ColCount(int x)
  63. {
  64.         int i = 0, j = x;
  65.         while (i < Mac.size() - j)
  66.         {
  67.                 if(Mac)
  68.         }
  69.  
  70.  
  71. }
  72.