Advertisement
Raslboyy

206

Sep 18th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     ifstream fin("input.txt");
  9.     ofstream fout("output.txt");
  10.  
  11.     int n, m;
  12.     fin >> n >> m;
  13.     vector<vector<int>> dp(n, vector<int>(m, 1));
  14.     for (int i = 1; i < n; i++)
  15.         for (int j = 1; j < m; j++)
  16.             dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
  17.     fout << dp[n - 1][m - 1] << endl;
  18.  
  19.     fin.close();
  20.     fout.close();
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement