Advertisement
welleyth

1704. Clever turtle

Dec 27th, 2020
1,042
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define int long long
  6. #define mp make_pair
  7. #define pb push_back
  8.  
  9. const int N = 33;
  10. const int INF = (int)1e18;
  11.  
  12. int dp[N][N];
  13.  
  14. signed main()
  15. {
  16.     ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
  17.     //freopen("input.txt","r",stdin);
  18.     //freopen("output.txt","w",stdout);
  19.  
  20.     int n,m;
  21.     cin >> n >> m;
  22.  
  23.     dp[1][1] = 1;
  24.  
  25.     for(int i=1;i<=n;i++)
  26.     {
  27.         for(int j=1;j<=m;j++)
  28.         {
  29.             dp[i][j] += dp[i-1][j] + dp[i][j-1];
  30.         }
  31.     }
  32.  
  33.     cout << dp[n][m];
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement