Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

动态规划-母牛生产问题补充解释 #1136

Open
Jay931003 opened this issue Oct 18, 2021 · 1 comment
Open

动态规划-母牛生产问题补充解释 #1136

Jay931003 opened this issue Oct 18, 2021 · 1 comment

Comments

@Jay931003
Copy link

第i年的牛的数量可以分为两部分:
一、“老牛”,即原来就有的牛,dp[i-1]
二、“新牛”,即今年新出生的牛。牛龄三岁及以上才能生新牛,所以新牛数量为dp[i-3],即三年前就存在的牛。
所以转移方程:dp[i] = dp[i-1]+dp[i-3]

@mkx000
Copy link

mkx000 commented Jan 28, 2024

第i年的牛的数量可以分为两部分: 一、“老牛”,即原来就有的牛,dp[i-1] 二、“新牛”,即今年新出生的牛。牛龄三岁及以上才能生新牛,所以新牛数量为dp[i-3],即三年前就存在的牛。 所以转移方程:dp[i] = dp[i-1]+dp[i-3]

good job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants