CF358D Dima and Hares

洛谷评测传送门

题目描述

Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more.

Dima felt so grateful to Inna about the present that he decided to buy her nn hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to nn from left to right and started feeding them with carrots. Inna was determined to feed each hare exactly once. But in what order should she feed them?

Inna noticed that each hare radiates joy when she feeds it. And the joy of the specific hare depends on whether Inna fed its adjacent hares before feeding it. Inna knows how much joy a hare radiates if it eats when either both of his adjacent hares are hungry, or one of the adjacent hares is full (that is, has been fed), or both of the adjacent hares are full. Please note that hares number 1 and nn don't have a left and a right-adjacent hare correspondingly, so they can never have two full adjacent hares.

Help Inna maximize the total joy the hares radiate.

CF358D Dima and Hares的更多相关文章

  1. CF358D Dima and Hares dp

    状态的定义挺奇特的~ 发现最终每一个物品一定都会被选走. 令 $f[i][0/1]$ 表示 $a[i]$ 在 $a[i-1]$ 前/后选时 $1$~$(i-1)$ 的最优解. 因为一个数字的价值只由其 ...

  2. Codeforces 358 D. Dima and Hares

    dp[i][0]表示i号兔子先于i-1号兔子喂食,dp[i][1]反过来. 倒着DP D. Dima and Hares time limit per test 2 seconds memory li ...

  3. Codeforces Round #208 (Div. 2) 358D Dima and Hares

    题目链接:http://codeforces.com/problemset/problem/358/D 开始题意理解错,整个就跪了= = 题目大意:从1到n的位置取数,取数的得到值与周围的数有没有取过 ...

  4. [CodeForce]358D Dima and Hares

    有N<3000只宠物要喂,每次只能喂一只,每喂一只宠物,宠物的满足度取决于: 1 紧靠的两个邻居都没喂,a[i] 2 邻居中有一个喂过了,b[i] 3 两个邻居都喂过了,c[i] 把所有宠物喂一 ...

  5. cf D. Dima and Hares

    http://codeforces.com/contest/358/problem/D 题意:ai代表相邻的两个野兔都没有吃食物情况下的快乐系数,bi代表的是在相邻的两个野兔中有一个吃到食物的快乐系数 ...

  6. Codeforces 358D Dima and Hares

    http://codeforces.com/contest/358/problem/D 题意:给出n个数,每个数取走的贡献与相邻的数有关,如果取这个数的时候,左右的数都还没被取,那么权值为a,如果左右 ...

  7. Codeforces 358D Dima and Hares:dp【只考虑相邻元素】

    题目链接:http://codeforces.com/problemset/problem/358/D 题意: 有n个物品A[i]摆成一排,你要按照某一个顺序将它们全部取走. 其中,取走A[i]的收益 ...

  8. codeforces358D Dima and Hares【dp】

    从本质入手,这个东西影响取值的就是相邻两个哪个先取 设f[i][0/1]为前i个(i-1,i)中先取i/i-1的值(这里不算上i的贡献 转移就显然了,注意要先复制-inf #include<io ...

  9. CF1252J Tiling Terrace

    CF1252J Tiling Terrace 洛谷评测传送门 题目描述 Talia has just bought an abandoned house in the outskirt of Jaka ...

随机推荐

  1. Docker安装MySQL 8.0并挂载数据及配置文件

    安装部署环境 Ubuntu 18.04.3 LTS Docker 19.03.2 MySQL latest(8.0.17) 下载镜像 # docker从仓库中拉取最新版的mysql镜像,如果没加标签的 ...

  2. spring注解实现事务

    码云: https://gitee.com/MarkPolaris/spring-transcation

  3. MySQL多表查询综合练习答案

    目录 一.综合练习 1.1 init.sql文件内容 1.2 从init.sql文件中导入数据 1.3 基础练习 1.4 进阶练习 二.基础练习答案 三.进阶练习答案 一.综合练习 1.1 init. ...

  4. 新安装的windows 10无法更新报0x80240fff错误的解决方案

    如果windows 10的安装文件比较老,可能会报0x80240fff错误导致无法更新. 网络上说的方法是选择推迟更新,因为这样貌似能让windows选择另外的更新服务器. 但实际上在我遇到的情况问题 ...

  5. Android Monkey的用法(一)

      Monkey 简介 ü  Monkey 是一个命令行工具,可以运行在 Android 模拟器里或真实设备中.它可以向系统发送伪随机(pseudo-random)的用户事件流(如按键输入.触摸屏输入 ...

  6. SpringBoot系列之外部配置用法简介

    SpringBoot系列之外部配置用法简介 引用Springboot官方文档的说法,官方文档总共列举了如下用法: 1.Devtools global settings properties on yo ...

  7. DatabaseLibrary -数据库操作

    操作数据库: Table Must Exist 验证表必须存在,存在则Pass,反之Fail Delete All Rows From Table 删除数据库中表的所有行 Execute Sql St ...

  8. python免密远程执行shell

    使用paramiko库:https://github.com/paramiko/paramiko 简单封装SSH类 import paramiko class SSH: def __init__(se ...

  9. .net core使用NLog日志

    前言:NLog日志对.net core web项目最新的支持在官网上有最新的介绍: 官网介绍地址:https://github.com/NLog/NLog/wiki/Getting-started-w ...

  10. 深入理解JVM,7种垃圾收集器

    本人免费整理了Java高级资料,一共30G,需要自己领取.传送门:https://mp.weixin.qq.com/s/JzddfH-7yNudmkjT0IRL8Q 如果说收集算法是内存回收的方法论, ...