上一页 1 2 3 4 5 6 7 8 9 ··· 21 下一页
摘要: 给出一棵树 ,和边的权值求权值最长的一条直径两次bfs求第一次以任意点开始 BFS求出第一个端点第二次以第一次得到的端点 BFS求出第二个端点#include #include #include #include #include #include #include #include #includ... 阅读全文
posted @ 2014-10-12 18:29 kewowlo 阅读(154) 评论(0) 推荐(0) 编辑
摘要: n个城市m条街道 要求完全匹配#include #include #include #include #include #include #include #include using namespace std;#include #include #include #include #includ... 阅读全文
posted @ 2014-10-09 22:24 kewowlo 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 题意:有三种类型的路类型 1. 从 U 到 V 能走INF个人 能躲 d 个人类型 2. 从 U 到 V 能走INF 个人 不能 躲人类型 3. 从 U 到 V 能走INF 个人 要用该路时需要花费一定费用要求能躲最多人 且花费最少类型3 的路最多有 12 条所以我们用二进制 枚举 类型3(也有递归... 阅读全文
posted @ 2014-10-09 22:16 kewowlo 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 最小流解法:先按照【上下界可行流】建图 但先不建end --> star 边MAXFlow=按新建的源点和汇点跑一次最大流再建end->star的边MAXFlow+=再按新建的源点和汇点跑一次最大流如果MAXFlow == 新建源点流出的sum值则 有ans = end->star的流量否则无ans... 阅读全文
posted @ 2014-10-08 22:25 kewowlo 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 完全看不下题目啊!!!全被这小萝莉吸引了啊!!!!!第i天与人建边源点与天建边汇点与人建边先判断是否可行然后输出#include #include #include #include #include #include #include #include using namespace std;#i... 阅读全文
posted @ 2014-10-08 20:07 kewowlo 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 传送门ISAP好长啊。。。居然打了20分钟。。。。#include #include #include #include #include #include #include #include using namespace std;#include #include #include #inclu... 阅读全文
posted @ 2014-10-08 16:29 kewowlo 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 文章:1.有上下界网络流问题2.一种简易的方法求解流量有上下界的网络中网络流问题3.上下界网络流上界用ci表示,下界用bi表示。若题目无下界则bi为01.无源汇可行流:下界是必须流满的,那么对于每一条边,去掉下界后,其自由流为ci– bi。Mi = sigma(i点进来的下界流) - sigma(i... 阅读全文
posted @ 2014-10-07 21:33 kewowlo 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 优先队列点按数值最小出队#include #include #include #include #include #include #include #include using namespace std;#include #include #include #include #include #... 阅读全文
posted @ 2014-10-07 19:46 kewowlo 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 比赛时愣是没读懂题意:有N 个城市 每个城市都有 val 个 士兵 , 有几条路连接当敌方攻击你的某个城市时 该城市以及与该城市相连接的城市的士兵总数 要大于 K不大于 K 该城市就被攻陷,士兵被俘虏 则不能支援别的城市求最后一共有多少城市不被攻陷,以及士兵总数思路:先计算该点能支援到的总士兵数然后... 阅读全文
posted @ 2014-10-06 20:58 kewowlo 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 题意:很多球组成一个金字塔第x层有 x*(x+1)/ 2 个球给你一个S 表示金字塔一层一层数下来的第S个球它在哪一层 这层中的第几行 第几列公式 1 : x*(x+1)*(x+2)/ 6公式 2 :x*(x+1)/ 2公式1为公式2 的前n项和#include #include #include ... 阅读全文
posted @ 2014-10-06 08:39 kewowlo 阅读(123) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 21 下一页