Hdu
文章平均质量分 73
haha_2678
Do the impossible!!!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Hdu 2098 题解
第一次学线性筛选素数,水一下Code:#include#include#includeusing namespace std;int prime[11100],pr,n;bool v[11100];void Solve(){ memset(v,1,sizeof(v)); pr=0; for(int i=2;i<=10000;i++) { if(v[i]原创 2015-01-29 09:49:11 · 357 阅读 · 0 评论 -
Hdu 1520 题解
简单树形dpf[x][1]+=f[y][0];f[x][0]+=max(f[y][0],f[y][1]);最后加上自己的权值即可。Code:#include#include#includeusing namespace std;struct node{ int x,y,next;}a[1110000]; int first[110000],len;int dp原创 2015-01-13 12:51:09 · 333 阅读 · 0 评论 -
Hdu 2196 题解
用了两种做法, 一种是每一个节点做根来扫果断O(n(n+m)) 显然不行另一种是1做根,判断每种情况把另外一个孩子节点的最大值和连上去的值加起来做treedp即可时间复杂度O(n+m)Code:#include#include#include#define max(x,y) (x)>(y)?(x):(y)using namespace std;int n;str原创 2015-01-14 13:59:23 · 432 阅读 · 0 评论
分享