摘要: 1. 邻接矩阵 2.邻接表 阅读全文
posted @ 2015-07-25 19:05 Pat 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 这是 DFS 系列的第一篇 。 首先给出一个重要的定理。该定理来自《算法导论》。 An undirected graph may entail some ambiguity in how we classify edges, since $(u,v)$ and $(v,u)$ are really 阅读全文
posted @ 2015-07-19 21:57 Pat 阅读(435) 评论(0) 推荐(0) 编辑
摘要: //2015/6/2 const int MAX_N=1e5+10; int prev[MAX_N]; struct Edge{ int to, prev; }; Edge E[MAX_N<<1]; void add_edge(int &id){ scanf("%d%d", &u, &v); E[id].to=v; E[id].prev=prev[u]; ... 阅读全文
posted @ 2015-07-08 17:54 Pat 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 传送门:欧拉路·二 #1181 : 欧拉路·二 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 在上一回中小Hi和小Ho控制着主角收集了分散在各个木桥上的道具,这些道具其实是一块一块骨牌。主角继续往前走,面前出现了一座石桥,石桥的尽头有一道火焰墙,似乎无法通过。小Hi注 阅读全文
posted @ 2015-07-08 17:52 Pat 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 2015年辽宁省赛热身赛有一道高精度乘法 传送门:NEUOJ 1574 A*B 1574: A * B 题目描述 Calculate $a \times b$. Calculate $a \times b$. 输入 Your program will be tested on one or more 阅读全文
posted @ 2015-07-06 20:49 Pat 阅读(1121) 评论(0) 推荐(0) 编辑
摘要: One day, Nobita found that his computer is extremely slow. After several hours' work, he finally found that it was a virus that made his poor computer 阅读全文
posted @ 2015-07-04 15:20 Pat 阅读(283) 评论(0) 推荐(0) 编辑
摘要: 传送门:HDU 2896 病毒侵袭 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14348 Accepted Submission(s): 3 阅读全文
posted @ 2015-07-03 18:57 Pat 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 传送门:A Bug's Life Description Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature tw 阅读全文
posted @ 2015-05-29 13:22 Pat 阅读(404) 评论(0) 推荐(0) 编辑
摘要: 时间限制:5000ms单点时限:1000ms内存限制:256MB描述大家对斐波那契数列想必都很熟悉:$a_0 = 1, a_1 = 1, a_i = a_{i-1} + a_{i-2}, (i > 1)$。现在考虑如下生成的斐波那契数列:$a_0 = 1, a_i = a_j + a_k, i > 阅读全文
posted @ 2015-05-04 23:20 Pat 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 位运算是状态压缩DP的基础。 算符 C/C++中的位运算算符(按优先级排序): 红色算符与位运算算符的优先级高低顺序容易弄混,这里强调一下。 ! ~ (bitwise NOT) 按位非 ~x * / % + - > >= < <= << >> (bitwise left shift and righ 阅读全文
posted @ 2015-05-03 16:24 Pat 阅读(220) 评论(0) 推荐(0) 编辑