采药-动态规划题解(C语言代码) 一看到题就发现这是动态规划,题目要求最大获利之类的时候也一般想到动态规划,动态规划的题就是用空间换取时间,建立一个表存储需要重复计算的自问题,表的最后一项的值就是我们要求的最优值。动态规划的题先分析需要求的最大值是什么,这道题是价值的最大值,而子问题就是草药种类以及时间量两方面不同情况下的最优解。 题解列表 2019年10月25日 0 点赞 0 评论 1328 浏览 评分:8.4
采药-题解(C语言代码) 摘要:```c #include int max(int a, int b) { return a>b ? a:b; } int main() { int T, M, i,j; …… 题解列表 2019年08月28日 0 点赞 0 评论 1482 浏览 评分:6.0
采药-题解(Python代码) 写着玩的,大家凑合着看吧,哈哈哈```pythontimeout,num=0,0#记录时间上限和草药数量t=[0]#记录每种草药的花费时间v=[0]#记录每种草药的价值timout,num=map(int,input().split())foriinrange(num):#赋值。 题解列表 2019年06月17日 0 点赞 0 评论 2461 浏览 评分:9.0
采药 (C语言代码) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int max(int a, int b){ return a>b ? a:b;}int main(){ int T, M,…… 题解列表 2019年05月21日 0 点赞 0 评论 2059 浏览 评分:0.0
采药 (看楼上大佬的就行,我只是留一下足迹) 摘要:解题思路:注意事项:参考代码:#include <stdio.h>#define max(x,y) (x)>(y)?(x):(y) int main(){ int dp[102][1001]={0},…… 题解列表 2019年05月06日 0 点赞 0 评论 1429 浏览 评分:0.0
采药 (C语言代码) 摘要:解题思路:虽然超时了,不过还想贴一下昂递归思路来做的把所有可能性算一遍,暴力了一点注意事项:参考代码:#include<stdio.h>#include<string.h>struct node{ i…… 题解列表 2019年04月18日 0 点赞 0 评论 1483 浏览 评分:0.0
采药 (C语言代码) 摘要:解题思路:贴段代码注意事项:参考代码:#include<stdio.h>#include<string.h>int A[150],B[150],C[1500];int main(){ int N,M,…… 题解列表 2019年04月18日 0 点赞 0 评论 1437 浏览 评分:0.0
采药 (C++代码)DP(动态规划) 摘要:解题思路: 标准的01背包问题。参考代码:#include<iostream> #include<cmath> #define hh ios::sync_with_stdio(false),…… 题解列表 2019年03月23日 0 点赞 0 评论 1584 浏览 评分:0.0
采药 (C++代码) 摘要:解题思路:0/1背包问题,动态规划解决注意事项:参考代码:#include<iostream>#include<string.h>using namespace std;#define maxn 10…… 题解列表 2019年03月23日 0 点赞 0 评论 1279 浏览 评分:0.0
采药 (C++代码) 摘要:解题思路: 0/1背包问题参考代码:#include <iostream> #include<cmath> using namespace std; int T,M,ValueSum; in…… 题解列表 2019年03月18日 0 点赞 0 评论 1389 浏览 评分:0.0