Advertisement
Guest User

Контрольная стратегия

a guest
Jan 17th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. //
  2. //  main.cpp
  3. //  STRATEGY
  4. //
  5. //  Created by Андрей Москалёв on 17.01.17.
  6. //  Copyright © 2017 Андрей Москалёв. All rights reserved.
  7. //
  8.  
  9. #include <iostream>
  10.  
  11. using namespace std;
  12.  
  13. int main(int argc, const char * argv[]) {
  14.     int n;
  15.     cin >> n;
  16.     int x[n][n];
  17.     for (int i = 0; i < n; ++i) {
  18.         for (int j = 0; j < n; ++j) {
  19.             if (i + j == n - 1) x[i][j] = 1;
  20.             else if (i + j < n) x[i][j] = 0;
  21.             else x[i][j] = 2;
  22.         }
  23.     }
  24.     for (int i = 0; i < n; ++i) {
  25.         for (int j = 0; j < n; ++j) {
  26.             cout << x[i][j] << ' ';
  27.         }
  28.         cout << endl;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement