标签:dp
SDUT 3033 (坑)
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
using namespace std;
struct node
{
LL s,p,w;
}q[10];
int main()
{
LL n,v,i,j,k;
while(~scanf("%lld%lld",&n,&v))
{
LL ans = 0;
memset(q,0,sizeof(q));
for(i=0;i<n;i++)
scanf("%lld%lld%lld",&q[i].s,&q[i].p,&q[i].w);
for(i=0;i<=q[0].s;i++)
{
for(j=0;j<=q[1].s;j++)
{
for(k=0;k<=q[2].s;k++)
{
LL t = i*q[0].p+j*q[1].p+k*q[2].p;
if(v>=t)
{
ans=max(i*q[0].w+j*q[1].w+k*q[2].w,ans);
}
}
}
}
printf("%lld\n",ans);
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:dp
原文地址:http://blog.csdn.net/grit_icpc/article/details/48059395