
树形dp
A_root_A
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
树形dp 题目清单
树上的动态规划 树的最大独立集 #include<bits/stdc++.h> using namespace std; #define maxn 100 vector<int> v[maxn]; int d[maxn], s[maxn], gs[maxn]; int dfs(int n, int fa) { for(int i = 0; i < v[n...原创 2018-08-27 14:48:33 · 397 阅读 · 0 评论 -
codeforces 14D 暴力 树形dp
题意:有n个城市 , n-1条路。求断开一条路之后分成的两部分所构成的树的直径的积的最大值; 分析:n的取值范围不大,所以暴力枚举每条边。 #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #include <stdlib....原创 2018-10-25 11:26:37 · 266 阅读 · 0 评论 -
poj 1655 树的重心
#include<cstdio> #include<algorithm> #include<cstring> #include<cmath> #include<vector> using namespace std; const int maxn = 20000; vector<int> tree[maxn + 5]; ...原创 2018-10-23 10:59:58 · 180 阅读 · 0 评论 -
Hali-Bula的晚会 uva 1220
#include<bits/stdc++.h> using namespace std; #define maxn 300 vector<int> v[maxn]; int d[maxn][2],f[maxn][2]; map<string,int>mp; void dfs(int n) { if(v[n].size()==0) { ...原创 2018-10-24 18:48:42 · 205 阅读 · 0 评论 -
树上顶点的平均距离
#include <bits/stdc++.h> using namespace std; #define ll long long const int maxn=10010; struct node { int v,w; }a,b; vector<node>tree[maxn]; int sum[maxn],n; ll dp[maxn]; void dfs(in...原创 2018-11-01 19:03:50 · 331 阅读 · 0 评论