1 solutions

  • 0
    @ 2022-6-6 19:36:17
    #include <bits/stdc++.h>
    using namespace std;
    #define accelerate ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
    #define endl "\n";
    #define mod 1000000007
    #define ll long long
    #define PII pair<int,int>
    #define INF 0x3f3f3f3f
    const int N=1e5+10;
    int n,m,k,x,y,T,ans;
    int dp[50][50];
    int main(){
    	accelerate;
    	cin>>n>>m;
    	for(int i=1;i<=m;i++){
    		dp[1][i]=1;
    	}
    	for(int i=1;i<=n;i++){
    		dp[i][1]=1;
    	}
    	for(int i=2;i<=n;i++){
    		for(int j=2;j<=m;j++){
    			if(i&1||j&1){
    				dp[i][j]=dp[i-1][j]+dp[i][j-1];
    			}
    		}
    	}
    	cout<<dp[n][m];
    	return  0;
    }
    
    • 1

    Information

    ID
    6495
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    117
    Accepted
    21
    Uploaded By