Advertisement
Nik_Perepelov

Сижу на полу черчу спирали

Jan 26th, 2023
1,038
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n;
  7.     cin >> n;
  8.  
  9.  
  10.     for (int i = 0; i < n; i++) {
  11.         for (int j = 0; j < n; j++) {
  12.             if ((i <= n / 2 && !(i % 2) && n - i > j && i - 3 < j) ||
  13.                 (j > n / 2 && !(j % 2) && i < j && n - i <= j) ||
  14.                 (i > n / 2 && !(i % 2) && i >= j && n - i <= j) ||
  15.                 (j < n / 2 && !(j % 2) && i - 1 > j && n - i > j)) {
  16.                 cout << '1' << ' ';
  17.             } else {
  18.                 cout << '0' << ' ';
  19.             }
  20.         }
  21.         cout << '\n';
  22.     }
  23.  
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement