思路:树上的动态规划。只能刷部分节点数m,总节点数n。如果m>=n那么就可以全刷了,那就不用任何算法了。如果m 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int N2=110; //平方 8 con...
分类:
其他好文 时间:
2015-04-20 14:27:58
阅读次数:
83
http://blog.sina.com.cn/s/blog_61bebe480100v7c7.html基本的C++算法分为三类:排序算法、树算法、图算法算法思想有三种:递推、分治、动态规划 以及 贪心算法。本文将简要介绍上面三类算法,介绍时穿插介绍算法思想。一、排序算法1、基本O(n^2)排序算法...
分类:
编程语言 时间:
2015-04-20 10:51:33
阅读次数:
201
【题目链接】:click here~~
【题目大意】:题意:给出一个w*h的方格,问除去不能走的路,从(0,0)到(w,h)共有多少种走法。
【解题思路】:第七场比赛的题,最后一小时在看这道题,比较遗憾最后还是没有A出来,赛后重新看了看题目,理清一下思路,发现就是道简单的dp,
处理一下除去不能走的路,不过要注意题目的一句话:“ The blocking is done in such a...
分类:
其他好文 时间:
2015-04-20 08:10:55
阅读次数:
127
动态规划
#include
#include
#include
#include
using namespace std;
char a[1005];
const int INF = 100007;
int num[1005];
int dp[1005][1005];
int main(){
int n;
cin >> n;
for(int cases = 1; cases...
分类:
其他好文 时间:
2015-04-19 22:50:14
阅读次数:
143
Your Ways
You live in a small well-planned rectangular town in Phuket. The size of the central area of the town is H kilometers x W kilometers. The central area is divided into HW unit blocks, e...
分类:
其他好文 时间:
2015-04-19 21:28:12
阅读次数:
231
//就想象成t行11列的数,从下往上遍历相加,找最大值。#include
#include
int dp[100005][13];
int Max(int a,int b,int c)
{
int max=a;
if(max<b)
max=b;
if(max<c)
max=c;
return max;
}
int main()
{
int n,x,t,max;
while(sc...
分类:
其他好文 时间:
2015-04-19 21:26:41
阅读次数:
149
动态规划(dynamic programming)与分治算法相似,都是通过组合子问题的解来求解原问题(在这里,“programming”指的是一种表格法,并非编写计算机程序)。分治方法将问题规划为互不相交的子问题,在将他们组合起来,求出原问题的解。与之相反,动态规划应用于子问题重叠的情况,即不同的子...
分类:
其他好文 时间:
2015-04-19 19:28:45
阅读次数:
126
描述
给定字符串,求它的回文子序列个数。回文子序列反转字符顺序后仍然与原序列相同。例如字符串aba中,回文子序列为"a", "a", "aa", "b", "aba",共5个。内容相同位置不同的子序列算不同的子序列。
输入
第一行一个整数T,表示数据组数。之后是T组数据,每组数据为一行字符串。
输出
对于每组数据输出一行,格式为"Case #X: Y",X代表数据编号(从1开始),Y为答...
分类:
其他好文 时间:
2015-04-19 16:15:49
阅读次数:
443
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
给定一个充满0和1的矩阵,要求出范围全为1的矩阵的面积。
算法一,动态规划
此题,以每行为底,都可以转换成是一个Largest
Rec...
分类:
其他好文 时间:
2015-04-19 14:45:57
阅读次数:
115
内容:调试强化学习算法(RL算法)LQR线性二次型调节(french动态规划算法)滤波(kalman filters)线性二次高斯控制(LGG)Kalman滤波器卡尔曼滤波(Kalman filtering)一种利用线性系统状态方程,通过系统输入输出观测数据,对系统状态进行最优估计的算法。由于观测数...
分类:
其他好文 时间:
2015-04-19 11:23:41
阅读次数:
249