

【dfs题解】---只有50分
(头一回自己用dfs做出来了dp的hard等级的大题,从来没有拿50分这么高兴过哈哈哈哈哈)
#include <bits/stdc++.h>
using namespace std;
int n,m;
long long ans=0;
const long long mol=1e9+7;
void dfs(int h,int d,int sum)
{
if(h<0||d<0||sum<=0)
return;
if(h==0&&d==0&&sum==2)
{
ans++;
ans%=mol;
return;
}
if(sum%2!=0)
{
dfs(h-1,d,sum+1);
}
else{
dfs(h-1,d,sum+1);
dfs(h,d-1,sum/2);
}
}
int main()
{
scanf("%d%d",&n,&m);
dfs(m-2,n,2);
printf("%d",ans);
return 0;
}
dp题解等赛后再补上