Advertisement
LEGEND2004

A - Clever turtle

Aug 31st, 2023
670
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define int long long
  5.  
  6. int n , m;
  7. int dp[35][35];
  8.  
  9. signed main()
  10. {
  11.     cin >> n >> m;
  12.     for(int i = 1; i <= n; i++){
  13.         for(int j = 1; j <= m; j++){
  14.             if((i == 1) && (j == 1)){
  15.                 dp[i][j] = 1;
  16.                 continue;
  17.             }
  18.             dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
  19.         }
  20.     }
  21.     cout << dp[n][m] << endl;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement