上一页 1 2 3 4 5 6 7 8 9 10 ··· 21 下一页
摘要: 经典树形DP#include #include #include #include #include #include #include #include using namespace std;#include #include #include #include #include #includ... 阅读全文
posted @ 2014-10-04 21:48 kewowlo 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 求最多有多少个点落在 一个单位圆内复杂度 O ( n^2 log n)#include #include #include #include #include #include #include #include using namespace std;#include #include #incl... 阅读全文
posted @ 2014-10-04 21:41 kewowlo 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 题意:求节点间的最大距离先DFS一次 记录下 每一节点的子树下的最大距离(DP[ u ] [ 0 ])和第二大距离(DP[ u ] [ 1 ])用DP[ v ] [ 2 ] 表示由v的父节点来的最大距离再取DP[ u ] [ 0 ] 与 DP[ u ][ 2 ] 的最值#include #inclu... 阅读全文
posted @ 2014-10-04 10:10 kewowlo 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 类似推箱子自己不会掉出地图每次移动N步时把 自己起始位置 到 末位置 路上的棋子 都放到 队列里然后沿着走的同一个方向取出棋子放在图上,若原格子也有棋子则也放进队列中(貌似 ^ v 表示的数字恰当可以方便很多)#include #include #include #include #include... 阅读全文
posted @ 2014-10-03 22:03 kewowlo 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 裸树形DP 练手必备#include #include #include #include #include #include #include #include #include #include #include using namespace std;#include #include #in... 阅读全文
posted @ 2014-10-03 21:53 kewowlo 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 给出根节点(BOSS)然后还有N-1个边 A B 由B指向A (B为A 的上司)每次只能选择这个关系中的其中一个求最多选几个点并且输出是不是唯一的重点判断是否唯一:1.若下属不去和去都人数一样的话则上司不去的话就不唯一(上司去了下属必定不能去,所以不满足)2.若下属不去还不唯一的话 上司去了也是不唯... 阅读全文
posted @ 2014-10-03 21:50 kewowlo 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题意:A-Z&&a-z 表示 集结点从A点出发经过 最短步数 走到下一个集结点(A的下一个集结点为B ,Z的下一个集结点为a) 的路上遇到金子(*)则可以捡走(一个点只能捡一次)求从A点出发走遍所有的的集结点 最多能捡多少金子思路:先对于第 i 个集结点用BFS求出 对于每个点从该集结点所需的步数 ... 阅读全文
posted @ 2014-10-03 08:40 kewowlo 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 给出一个N*M的字符矩阵 再给出P行字符题目上说P行中必定存在与矩阵中。。直接统计矩阵中字符个数然后减去P行的字符,然后输出剩下的字符(按照字典树)#include #include #include #include #include #include #include #include #inc... 阅读全文
posted @ 2014-10-02 19:08 kewowlo 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 给出 N 种货币 M 条兑换关系 开始时所有的货币S 和有X 块钱接下来M条关系A B W1 W2 W3 W4表示A->B 所需的手续费为W2块钱 汇率为W1B->A 所需的手续费为W4块钱 汇率为W3所以对于输入的一行建两条边要求到最后可以赚到钱所以当出现了负圈即可赚到无限多的钱#include ... 阅读全文
posted @ 2014-10-02 19:05 kewowlo 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 两个粒子相撞 变成一个粒子 其质量为m=2*sqrt(m1*m2)求最后剩下一个粒子时可能的最小质量瞎搞发现从大到小和会最小#include #include#include#include#includeusing namespace std;int cmp(double x,double y){... 阅读全文
posted @ 2014-10-02 19:00 kewowlo 阅读(142) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 21 下一页