
区间DP
creator平
期望破茧成蝶时的飞翔,向往突破蝉蛹后的鸣叫。
展开
-
nyoj737—石子合并(一)(区间DP)
描述 有N堆石子排成一排,每堆石子有一定的数量。现要将N堆石子并成为一堆。合并的过程只能每次将相邻的两堆石子堆成一堆,每次合并花费的代价为这两堆石子的和,经过N-1次合并后成为一堆。求出总的代价最小值。输入有多组测试数据,输入到文件结束。每组测试数据第一行有一个整数n,表示有n堆石子。接下来的一行有n(0< n <200)个数,分别表示这n堆石子的数目,用空格隔开...原创 2018-10-30 13:55:09 · 224 阅读 · 0 评论 -
UVA - 10891——Game of Sum(区间dP)
题目链接:https://vjudge.net/problem/UVA-10891题意:n个数的序列,A和B两个人比赛,A先取,可以从剩下序列的左边或者右边开始取,每次任取1~n个数字,两人都用最优方案,求A的总和减去B的总和思路:dp[i][j]表示区间i~j先手能获得的最大值。 dp[i][j]=sum[i][j]-min{dp[i+1][j]......dp[...原创 2019-08-05 10:21:42 · 176 阅读 · 0 评论 -
ZOJ - 3469-Food Delivery (区间DP)
When we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this time, we may call for food delivery.Suppose there are N people living ...原创 2018-11-06 14:06:40 · 177 阅读 · 0 评论 -
POJ - 1651 Multiplication Puzzle (区间DP)
The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and scores the number of points equal to the pr...原创 2018-11-01 21:07:23 · 115 阅读 · 0 评论 -
CodeForces - 149D Coloring Brackets (区间DP+DFS)
Once Petya read a problem about a bracket sequence. He gave it much thought but didn't find a solution. Today you will face it.You are given string s. It represents a correct bracket sequence. A cor...原创 2018-11-01 20:42:59 · 247 阅读 · 0 评论 -
POJ - 2955 Brackets (区间DP)
We give the following inductive definition of a “regular brackets” sequence:the empty sequence is a regular brackets sequence, if s is a regular brackets sequence, then (s) and [s] are regular brac...原创 2018-10-31 21:24:08 · 126 阅读 · 0 评论 -
LightOJ - 1422 Halloween Costumes (区间DP)
Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's Halloween, these parties are all costume parties, Gap...原创 2018-10-31 20:01:25 · 150 阅读 · 0 评论 -
ZOJ - 3537 Cake (区间DP+凸包)
You want to hold a party. Here's a polygon-shaped cake on the table. You'd like to cut the cake into several triangle-shaped parts for the invited comers. You have a knife to cut. The trace of each cu...原创 2018-10-31 14:25:24 · 159 阅读 · 0 评论 -
HihoCoder - 1636——Pangu and Stones (区间DP)
题目链接:https://vjudge.net/contest/329530#problem/Jdp【i】【j】【k】:i,j表示区间【i,j】,k表示分为k堆石子。dp表示区间【i,j】分为k堆石子的最小价值#include<string.h>#include<stdio.h>#include<algorithm>using namespace...原创 2019-09-30 10:51:27 · 143 阅读 · 0 评论