![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
acm套题
文章平均质量分 80
work_freedom
这个作者很懒,什么都没留下…
展开
-
HDU 4292网络流
//2012成都网赛E题 food 思路: 题目一看就知道是网络流啦。题目要求一个人既要得到一份喜欢的food有要有一份喜欢的drink,要处理其实也很简单,将一个人拆成两个点,如A,A‘,利用A‘来限流,假如food流到A的流量是3,我们连一条A到A’的边,边的权为1,这样就将流量限制成为1了。 网络流很多地方都可以多建立几个点。。。本菜太弱,建议弱友们可以在前期多多练习建图,至于算法 网上原创 2012-09-18 18:16:48 · 444 阅读 · 0 评论 -
HDU 4294 spfa
题目: Groups After the regional contest, all the ACMers are walking alone a very long avenue to the dining hall in groups. Groups can vary in size for kinds of reasons, which means, several pl原创 2012-09-18 18:54:20 · 400 阅读 · 0 评论 -
HDU 4288线段树
//2012成都网赛a题 思路: 关键是想到直接 将所有出现过的数字作为叶子节点建一棵空的树(就是树中节点暂时不保存任何值)。然后add就添加,del就删,直接模板水之~~~ 这道题stl的vector也可以水过 ,真没天理呀。弱菜表示不懂肿么算stl的复杂度了~~~ #include #include #include #include #include #in原创 2012-09-18 17:58:47 · 690 阅读 · 0 评论 -
hdu 4407 sum
//2012金华网赛 1008 今天居然挂在了09了 ,n^3的算法 呀,不知道自己写挫了,还是爆rp了,居然老是t;话说这道题目也写得很挫。 这道题有个很好的性质1..n连续 。而且询问又很少,所以直接先求出原数组中(即1..n) 与p互质的数的和,具体肿么求可以用容斥原理。然后枚举被改变的数。#include #include #include #includ原创 2012-09-22 18:50:04 · 570 阅读 · 0 评论 -
hdu 4405 Aeroplane chess
//2012金华网赛1006 求概率的题,这不是一道有无穷多种情况的概率题,所以不用推公式。很容易想到dp解法。 定义状态很状态转移看代码吧,都比较简单 #include #include #include #include #include #include #define fr(i,s,n) for(int i=s;i<n;i++) #define pf pri原创 2012-09-22 18:56:45 · 508 阅读 · 0 评论 -
HDU 4289 网络流
题目: Control You, the head of Department of Security, recently received a top-secret information that a group of terrorists is planning to transport some WMD 1 from one city (the source) to原创 2012-09-18 19:04:17 · 852 阅读 · 0 评论 -
ZOJ 3656 2-sat模板题
//2012长春现场赛 很裸的2-sat 因为是位运算,所以 把b[i] 的 每一位都利用 2-sat 判断一次。 #include #include #include #include #include #include #include #define fr(i,s,n) for(int i=s;i<n;i++) #define fi freopen("in.txt","r原创 2012-10-17 20:25:36 · 520 阅读 · 0 评论