【Atcoder Beginner Contest 261- D】C++

该博客详细介绍了Atcoder Beginner Contest 261中D题——翻转与奖励的题目内容和解题思路。问题涉及到在一系列硬币翻转游戏中,如何最大化获得的奖金,其中包括连胜奖励。文章讨论了如何通过动态规划来解决这个问题,并给出了代码实现。
摘要由CSDN通过智能技术生成

https://atcoder.jp/contests/abc261/tasks/abc261_d

D - Flipping and Bonus 

Time Limit: 2 sec / Memory Limit: 1024 MB

Score : 400400 points

Problem Statement

Takahashi will toss a coin NN times. He also has a counter, which initially shows 00.

Depending on the result of the ii-th coin toss, the following happens:

  • If it heads: Takahashi increases the counter's value by 1 and receives Xi​ yen (Japanese currency).
  • If it tails: he resets the counter's value to 0, without receiving money.

Additionally, there are MM kinds of streak bonuses. The i-th kind of streak bonus awards Yi​ yen each time the counter shows Ci​.

Find the maximum amount of money that Takahashi can receive.

Constraints

  • 1≤M≤N≤5000<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值