hopingsteam

Untitled

Apr 11th, 2020
210
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include    <iostream>
  2. #include    <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("bac.in");
  7.  
  8. int main()
  9. {
  10.     int n = 4, m = 5;
  11.     int mat[25][25];
  12.  
  13.     for(int i = 1; i <= n; i++)
  14.         mat[i][m] = 1;
  15.     for(int j = 1; j <= m; j++)
  16.         mat[n][j] = 1;
  17.  
  18.     for(int i = n - 1; i >= 1; i--)
  19.     {
  20.         for(int j = m - 1; j >= 1; j--)
  21.             mat[i][j] = (mat[i][j + 1] + mat[i + 1][j]) % 10;
  22.     }
  23.  
  24.     for(int i = 1; i <= n; i++)
  25.     {
  26.         for(int j = 1; j <= m; j++)
  27.             cout << mat[i][j] << " ";
  28.         cout << "\n";
  29.     }
  30.     return 0;
  31. }
RAW Paste Data