Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- using namespace std;
- int main() {
- ifstream fin("input.txt");
- ofstream fout("output.txt");
- int n, m;
- fin >> n >> m;
- vector<vector<int>> dp(n, vector<int>(m, 1));
- for (int i = 1; i < n; i++)
- for (int j = 1; j < m; j++)
- dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
- fout << dp[n - 1][m - 1] << endl;
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement