P1048 [NOIP2005 普及组] 采药 题解
#include
#include
#include
#include
#define s(x,y) sort(x.begin(),x.end(),y);
#define lowbit(x) ((x)&-(x));
using namespace std;
typedef long long ll;
const ll bitwise_max = 33;
ll dp[1010];
struct node
{
ll time, val;
}a;
int main()
{
ll t, m;
scanf("%lld %lld", &t, &m);
while (m--)
{
scanf("%lld %lld", &a.time, &a.val);
for (ll i = t; i >= a.time; i--)
{
dp[i] = max(dp[i], dp[i - a.time] + a.va
共有 0 条评论