Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream fin("bac.in");
- int main()
- {
- int n = 4, m = 5;
- int mat[25][25];
- for(int i = 1; i <= n; i++)
- mat[i][m] = 1;
- for(int j = 1; j <= m; j++)
- mat[n][j] = 1;
- for(int i = n - 1; i >= 1; i--)
- {
- for(int j = m - 1; j >= 1; j--)
- mat[i][j] = (mat[i][j + 1] + mat[i + 1][j]) % 10;
- }
- for(int i = 1; i <= n; i++)
- {
- for(int j = 1; j <= m; j++)
- cout << mat[i][j] << " ";
- cout << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement