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

URAL - 1244 Gentlemen(01背包+记录路径) | -xCodingx- #36

Open
xTayEx opened this issue Feb 17, 2019 · 0 comments
Open

URAL - 1244 Gentlemen(01背包+记录路径) | -xCodingx- #36

xTayEx opened this issue Feb 17, 2019 · 0 comments

Comments

@xTayEx
Copy link
Owner

xTayEx commented Feb 17, 2019

https://xtayex.github.io/2019/02/17/URAL-1244-Gentlemen/#more

URAL - 1244 Gentlemen   一道01背包的题目,只不过这一次不是用01背包来求最大值或最小值,而是将背包填满。这只需要将数组dp[]的dp[0]设为0,将其他设为 -∞即可(原因:这是为什么呢?可以这样理解:初始化的 F 数组事实上就是在没有任何物品可以放 入背包时的合法状态。如果要求背包恰好装满,那么此时只有容量为 0 的背包可以在什 么也不装且价值为 0

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

No branches or pull requests

1 participant