题解 1272: 采药[NOIP2005复赛普及组]

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

P1005 (C++代码)

摘要:解题思路:注意事项:大神回来啦!!参考代码:献上代码:#include<bits/stdc++.h> using namespace std; int max(int a,int b)//……

P1005 (C语言代码)

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int a[1001];int main(){ int t,m; int i,j,k,l; int sj[101],jz[101]; s……

P1005 (C++代码)

摘要:解题思路:注意事项:参考代码:#include<iostream> #include<algorithm> using namespace std; const int Nmax=105,Vma……

P1005 (C++代码)

摘要:解题思路:动态规划注意事项:参考代码:#include <cstdlib>#include<iostream>using namespace std;int s[1001];int main(int ……

P1005 (C语言代码)

摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<stdlib.h>#include<malloc.h>#define maxn 1001#define MAX(a,b……

P1005-题解(Java代码)

经典的01背包问题,使用动态规划。dp[i][j]含义,前i株草药中,j时间内可以获得的最大价值。**dp[i][j]=max{dp[i-1][j],dp[i-1][j-time[i]]+value[i]}**前者表示不采第i株草药;后者表示采第i株草药,此时要预留time[i]时间。