dfs跑指数型遍历 哥三好

#include<iostream>
#include<cstring>
using namespace std;

typedef long long ll;

const int mod = 1e9 + 7;
const int N=1e5+100;
ll f[107][107][107];

ll dfs(ll x, ll y, ll z)
{
	if(x<2 and y<2 and z<2)  return 1;
	
	if(f[x][y][z] != -1) return f[x][y][z];
	
	ll ans = 0;
	if(x>=2)
		ans += dfs(x-2,y,z); ans%=mod;
	if(y>=2)
		ans += dfs(x,y-2,z); ans%=mod;
	if(z>=2) 
		ans += dfs(x,y,z-2); ans%=mod;
		
	if(x>=3)
		ans += dfs(x-3,y,z); ans%=mod;
	if(y>=3)
		ans += dfs(x,y-3,z); ans%=mod;
	if(z>=3) 
		ans += dfs(x,y,z-3); ans%=mod;
		
	if(x>=5)
		ans += dfs(x-5,y,z); ans%=mod;
	if(y>=5)
		ans += dfs(x,y-5,z); ans%=mod;
	if(z>=5) 
		ans += dfs(x,y,z-5); ans%=mod;
	
	return f[x][y][z] = ans%mod;
	
}


void solve()
{
	ll a, b, c;
	cin >> a >> b >> c;
	memset(f,-1,sizeof f);
	cout << dfs(a/150,b/150,c/150);
}

int main()
{

	ios::sync_with_stdio(false);cin.tie(0);
		solve();
	return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值