题解列表

筛选

01背包问题(动态规划 自下而上递推)

摘要:从小问题递推到大问题 递推dp[i][j]——把前i个物品(从第1个到第i个)装入容量为j的背包中获得的最大价值 从dp[0][0]递推到dp[n][m]就是答案 两种情况: (1)第i个物品……

The 3n+1 problem

摘要:解题思路:注意事项:参考代码:#include <iostream>#include <algorithm>using namespace std;long long len(long long n)……