题目描述
blablabla
样例
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+10,M=2*N,mod=1e9+7;
#define int long long
typedef long long LL;
typedef pair<int, int> PII;
typedef unsigned long long ULL;
using node=tuple<int,int,int>;
const long long inf=1e18;
int n,m,k;
unordered_map<int,int> f[105][105];
int dfs(int x,int y,int z){
if(x>n||y>m) return 0;
if(x==n&&y==m){
if(z==2) return 1;
else return 0;
}
if(f[x][y].count(z)) return f[x][y][z];
int res=0;
if(y+1<=m)
{
res+=dfs(x,y+1,z+1);
res%=mod;
}
if(x+1<=n&&z%2==0){
res+=dfs(x+1,y,z/2);
res%=mod;
}
return f[x][y][z]=res;
}
void solve()
{
cin>>n>>m;
cout<<dfs(0,1,1);
}
//1 2 3 4
signed main()
{
cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
int t=1;
//cin>>t;
while(t--) solve();
}
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla