Advertisement
STANAANDREY

9.16.2019 pb6

Sep 16th, 2019
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. //ifstream fin("bac.in");
  5.  
  6.  
  7. int main()
  8. {
  9.     int a[100][100];
  10.     int n;
  11.  
  12.     cin >> n;
  13.     for (int i = 0; i < n; i++)
  14.         a[0][i] = n;
  15.     int cn = n;
  16.     for (int i = 0; i < n; i++)
  17.     {
  18.         a[i][n - 1] = cn;
  19.         cn--;
  20.     }
  21.  
  22.     for (int i = 1; i < n; i++)
  23.         for (int j = n - 2; j != -1; j--)
  24.         {
  25.             a[i][j] = a[i - 1][j] + a[i][j + 1];
  26.         }//*/
  27.  
  28.  
  29.     for (int i = 0; i < n; i++)
  30.     {
  31.         for (int j = 0; j < n; j++)
  32.             cout << a[i][j] << ' ';
  33.         cout << endl;
  34.     }
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement