Krypton

126 篇文章 0 订阅

题目:
In the future several years, you will surely remember that you once participated in a special China Collegiate Programming Contest. Due to COVID-19, all parties had paid a lot of effort to eventually hold a rare online programming contest. As a problem writer, I would also like to express my sincere gratitude to the organizing committee, all the contestants and others who have worked hard in this process. I also sincerely wish you good results in this special contest and a special and sweat memory in the future.

Maybe several years later, you may recall that …

Once there was a mobile game, where there was a virtual currency called coupon that could only be purchased by RMB. Kelo found that relying on his liver alone cannot make him stronger, so he decided to purchase some coupons. When he opened the recharge page, he found that this game had seven recharge columns, and was holding an activity called “First Recharge Reward”. If it was the first time a recharge column was chosen, some additional coupons would be given to the player as a reward. A player might receive several rewards if he chose several different recharge columns. A column could be chosen for arbitrary times, but there would be no additional reward except for the first time it was chosen. Here is a table describing the price, amount of coupons in normal case and additional first recharge rewards of each column.

[Math Processing Error]
Kelo had recently earned [Math Processing Error] yuan by writing problems for China Collegiate Programming Contest. He decided to recharge all these [Math Processing Error] yuan to the game, and hoped to get as many coupons as possible with these hard-earned money.

Input
The only line contains an only integer [Math Processing Error] ([Math Processing Error]).

Output
Print the maximum amount of coupons Kelo might get.

Examples
Input
100
Output
1084
Input
198
Output
2108
题解:
01背包和完全背包的混合背包

#include <bits/stdc++.h>
using namespace std;
const int N=2005;
int f[N];
struct node {
	int k,v,w;
};
vector<node> e;
int main()
{
	int m;
	cin>>m;
	e.push_back({-1,1,18});
	e.push_back({-1,6,60+18});
	e.push_back({-1,28,280+28});
	e.push_back({-1,88,880+58});
	e.push_back({-1,198,1980+128});
	e.push_back({-1,328,3280+198});
	e.push_back({-1,648,6480+388});
	e.push_back({1,1,10});
	e.push_back({1,6,60});
	e.push_back({1,28,280});
	e.push_back({1,88,880});
	e.push_back({1,198,1980});
	e.push_back({1,328,3280});
	e.push_back({1,648,6480});
	for(int i=0;i<14;i++)
	{
		if(e[i].k==-1)
		{
			for(int j=m;j>=e[i].v;j--)
			{
				f[j]=max(f[j],f[j-e[i].v]+e[i].w);
			}
		}
		else
		{
			for(int j=e[i].v;j<=m;j++)
			{
				f[j]=max(f[j],f[j-e[i].v]+e[i].w);
			}
		}
	}
	cout<<f[m]<<endl;
	return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值