区间DP
区间DP
七九河开
这个作者很懒,什么都没留下…
展开
-
Ivan the Fool and the Probability Theory (思维DP)
题目 https://codeforces.com/contest/1248/problem/C 题意 给你一个n*m的方格,让你涂成黑白,问每个格子最多和一个临近格子相同的方案数 思路 推理发现如果某一行存在一个相邻的相同,那么他的下一行是固定的 只有一行的方案数很好求 dp[i] = dp[i-1] + dp[i-2] 这个相邻的可能在某一列也可能在某一行,ans = dp[n]...原创 2019-10-23 16:32:53 · 278 阅读 · 0 评论 -
Halloween Costumes LightOJ - 1422 (区间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-11-09 17:03:11 · 169 阅读 · 0 评论 -
Pangu and Stones HihoCoder - 1636 (区间dp)
In Chinese mythology, Pangu is the first living being and the creator of the sky and the earth. He woke up from an egg and split the egg into two parts: the sky and the earth. At the beginning, there...原创 2018-11-07 11:35:20 · 193 阅读 · 0 评论 -
K-inversions URAL - 1523 (DP+树状数组)
链接 https://cn.vjudge.net/problem/URAL-1523 题意 给你一个1-n的序列 问长度为K的序列有多少种 思路 首先想到DP 递推式 dp[i][j] = ∑dp[x][j-1] ( 1<x<i,a[x] > a[i]) 写成数组 即求当前(j-n)项和 #include <bits/stdc++.h> using n...原创 2018-12-11 14:24:00 · 183 阅读 · 1 评论