30 August
DP 复习。
参考 redbag 博客 提供的题表。
P2858 [USACO06FEB] Treats for the Cows
区间 DP。
转换思路,题面从外往里递推,我们采用从里往外递推,权值逐级递减的反向实现方式。
选择区间左端点或右端点更新答案。
int n, a[2003], f[2003][2003];
int main() {
scanf("%d", &n);
for (int i=1; i<=n; ++i) scanf("%d", &a[i]), f[i][i]=a[i]*n;
for (int k=1; k<n; ++k) for (int i=1; i+k<=n; ++i)
f[i][i+k]=max(f[i+1][i+k] + a[i]*(n-k), f[i][i+k-1] + a[i+k]*(n-k));
printf("%d\n", f[1][n]);
return 0;
}
P2867 [USACO06NOV] Big Square
多重背包。
30 August的更多相关文章
- centos各版本信息
CentOS version Architectures RHEL base Kernel CentOS release date RHEL release date Delay (days) 2.1 ...
- C#DateTime的用法
本文较详细地介绍了C#的DateTime对象的使用方法.DateTime.Now.ToShortTimeString() DateTime dt = DateTime.Now; dt.ToString ...
- Enhancing the Scalability of Memcached
原文地址: https://software.intel.com/en-us/articles/enhancing-the-scalability-of-memcached-0 1 Introduct ...
- CentOS和Redhat发行版linux内核版本的对应关系
由于Redhat和CentOS的发行版本现在众多,所以我们应该知道CentOS和Redhat及linux内核之间版本的对应关系对维护系统还是很有帮助的.对应的列表如下: Redhat 9.0————— ...
- Unofficial Microsoft SQL Server Driver for PHP (sqlsrv)非官方的PHP SQL Server 驱动
原文 Unofficial Microsoft SQL Server Driver for PHP (sqlsrv) Here are unofficial modified builds of Mi ...
- [官网]Linux版本历史
This is a list of links to every changelog. https://kernelnewbies.org/LinuxVersions 总结一下 2.6.x 存在了八年 ...
- CCF计算机网络会议日期
SenSys: November 5-8 2017, Deadline: April 3, 2017 CoNEXT: December 12-15 2017, Deadline: June 12, 2 ...
- c# 根据当前时间获取,本周,本月,本季度,月初,月末,各个时间段(转但是都是使用过)
DateTime dt = DateTime.Now; //当前时间 DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") 24小时制 Dat ...
- [ZZ]Sign Up for the First-Ever Appium Roadshow on August 20th in New York City
http://sauceio.com/index.php/2014/07/appium-roadshow-nyc/?utm_source=feedly&utm_reader=feedly&am ...
随机推荐
- python 操作openpyxl导出Excel 设置单元格格式以及合并处理
贴上一个例子,里面设计很多用法,根据将相同日期的某些行合并处理. from openpyxl import Workbook from openpyxl.styles import Font, Fil ...
- nginx windows安装基础
nginx在 window上运行需要1.17.3以上. 官方文件https://nginx.org/en/docs/windows.html nginx启动: 1:进入安装目录,双击nginx.exe ...
- unity全屏截图
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; ...
- python每日一练:0001题
第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)? import o ...
- Mac019--Ubuntu上安装Rancher
首先安装:VisualBox虚拟机. 下载:ubuntu镜像 (ubuntu基于linux的免费开源桌面PC操作系统) ======================================== ...
- python 入门学习之anaconda篇
还没下载的同学先点击这里进入anaconda官方网站进行下载. 然后点击安装,注意的是这里 安装好了之后呢,我们就开始进行Conda的环境管理,Conda的环境管理功能允许我们同时安装 若干不同版本的 ...
- oracle--单表查询
---单表的查询学习 --查询表的所有数据 select * from 表名;*代表所有 select * from emp; --查询表中指定字段的值 select 字段名1,字段名2,...fro ...
- linux下的SSHD被连接端口修改
连接别人:vim /etc/ssh/ssh_config 被连接: vim /etc/ssh/sshd_config 端口重启生效: /etc/init.d/sshd restart
- [集合]List
List 存取有序,有索引,可以重复 ArrayList去除集合中字符串的重复值(字符串的内容相同) public static void main(String[] args) { ArrayLis ...
- Python的__pycache__的文件夹
· 前言 用python编写好一个工程,在第一次运行后,总会发现工程根目录下生成了一个__pycache__文件夹,里面是和py文件同名的各种 *.pyc 或者 *.pyo 文件. 先大概了解一下py ...