随笔分类 -  HDU

上一页 1 2 3 4 5 6 7 8 9 10 ··· 19 下一页

 
HDU 4185
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4185两个挨着的'#'可以配成一对,求最多能配成几对挨着的'#'就连边,然后求一次最大匹配,答案是最大匹配除以二(因为1 2和2 1这两对匹配实际效果是1,但是会算成2)#include #include #inc... 阅读全文
posted @ 2014-07-18 14:21 LegendaryAC 阅读(222) 评论(0) 推荐(0)
HDU 4585
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4585从原来的人中找出战斗数值最接近的,输出他们两人的序号要在logn的复杂度完成查找,我用的是set,当然用map也可以,两个内部都是红黑树实现水题一道#include #include #include #in... 阅读全文
posted @ 2014-07-15 13:59 LegendaryAC 阅读(321) 评论(0) 推荐(0)
HDU 4268
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4268学会了multiset的用法,与set不同的是这个可以插入相同元素对w排序,对合适的w用multiset插入对应的h,logn完成查找#include #include #include #include #... 阅读全文
posted @ 2014-07-09 18:40 LegendaryAC 阅读(237) 评论(0) 推荐(0)
HDU 2907
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2907ans=(凸包顶点数-凸包凹面数量)*q-凸包凹面数量*p重点在求一个凸包的凹面数量,极角排序过后,当前点在凸包上,下一个点不在凸包上,则凹面数量加一。这个要求的东西说的十分晦涩,样例不足以解释题目,所以此题... 阅读全文
posted @ 2014-06-22 09:21 LegendaryAC 阅读(174) 评论(0) 推荐(0)
HDU 3829
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2970P个小朋友喜欢猫讨厌狗,喜欢狗讨厌猫,移除一定数量的猫狗,使开心的小朋友数量最多二分图最大独立集=顶点数-二分图最大匹配对喜好冲突的小朋友连边,因为对小朋友建图拆了点,求出的最大匹配要除以2和hdu 1068... 阅读全文
posted @ 2014-06-20 05:44 LegendaryAC 阅读(589) 评论(0) 推荐(0)
HDU 2813
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2813裸二分图最优匹配,需要用两个map把武将名字映射到点的序号上#include #include #include #include using namespace std;const int N=210;co... 阅读全文
posted @ 2014-06-13 14:52 LegendaryAC 阅读(162) 评论(0) 推荐(0)
HDU 4720
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4720包含三个点且最小的圆可能是三角形的外接圆或者是以任意两点连成线段的中点为圆心的园,找出最小的即可,然后判断麻瓜到圆心的距离和圆半径之间的关系,注意求外心的前提是三点不共线#include #include #... 阅读全文
posted @ 2014-06-12 20:25 LegendaryAC 阅读(250) 评论(0) 推荐(0)
HDU 1358
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1358求某个前缀的周期,用Next求循环节的题目#include #include #include #include using namespace std ;char B[1000005] ;int Next[... 阅读全文
posted @ 2014-05-20 21:35 LegendaryAC 阅读(144) 评论(0) 推荐(0)
HDU 3746
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3746kmp的Nxet数组求字符串循环节例题lenB%(lenB-Next[lenB])==0则其有周期lenB/(lenB-Next[lenB]),其中最小循环节长度是lenB-Next[lenB]#includ... 阅读全文
posted @ 2014-05-20 21:14 LegendaryAC 阅读(376) 评论(0) 推荐(0)
HDU 4725
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4725求1-n最短路,每个点有一个层数,相邻层之间花费k可以到达建图时把层数看成n个点,层到该层点距离为0,点到其相邻层距离为c,相邻层之间距离为c#include #include #include #inclu... 阅读全文
posted @ 2014-05-19 23:54 LegendaryAC 阅读(235) 评论(0) 推荐(0)
HDU 4635
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4635问:最多加多少条边,使得原图不是强连通图正向考虑有困难,不妨反向思考,既最少去掉几条边使得原图不是强连通。总边数sum=n*(n-1)时肯定是强连通,已经给了m条边,sum-=m这时把已经强连通的部分进行缩点... 阅读全文
posted @ 2014-05-13 23:30 LegendaryAC 阅读(776) 评论(0) 推荐(0)
HDU 3667
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3667最小费用最大流本题流量和费用不是线性关系,fee=a*flow*flow,所以常规套模板spfa无法得到最小费用观察到每条边流量上限只有5,则可以把一条流量为f的边拆成f条流量为1的边,每条边费用是a*(2*... 阅读全文
posted @ 2014-05-07 21:15 LegendaryAC 阅读(194) 评论(0) 推荐(0)
HDU 3062
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=30622sat判定性问题模板#include #include #include #include #include #include using namespace std ;struct node { i... 阅读全文
posted @ 2014-05-07 13:55 LegendaryAC 阅读(209) 评论(0) 推荐(1)
HDU 2292
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2292题意:1-n个节点,题目给出了完全二叉树的定义(这个定义似乎有歧义,此题以题目描述为准),且要保持最小堆性质(根节点小于左右子树内的任意元素),问有多少种不同组合解法:dp,dp[n]表示n个元素的合法排列数... 阅读全文
posted @ 2014-05-07 11:53 LegendaryAC 阅读(176) 评论(0) 推荐(0)
HDU 2485
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2485n个车站,m条边,两边之间费用为1,问最少摧毁多少车站,使得1-n无法在k时间内到达将2-(n-1)每个点拆成两个,并建立容量为1,费用为0的一条边,源点为1,汇点为2*n-2,这时求最小费用最大流,其中保证... 阅读全文
posted @ 2014-04-27 20:26 LegendaryAC 阅读(270) 评论(0) 推荐(0)
HDU 1533
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1533人和房子数量相同,每个人进房子,费用是人到房子的曼哈顿距离,求最小费用可用最小费用最大流求解,建立虚拟的源点和汇点即可#include #include #include #include using nam... 阅读全文
posted @ 2014-04-26 21:37 LegendaryAC 阅读(128) 评论(0) 推荐(0)
HDU 1402
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1402fft做O(nlog(n))大数乘法,kuangbin的模板#include #include #include #include #include using namespace std;const dou... 阅读全文
posted @ 2014-04-16 21:56 LegendaryAC 阅读(183) 评论(0) 推荐(0)
HDU 1498
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1498最小顶点覆盖,建立二分图求最大匹配#include #include #include using namespace std ;int M[105][105],k,n,match[505],vis[505]... 阅读全文
posted @ 2014-04-16 21:24 LegendaryAC 阅读(315) 评论(0) 推荐(0)
HDU 1281
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1281同行同列最多只能放一辆车,所以可以看做二分图。把x坐标和y坐标分别看做二分图的两边点集,把二分图的边看做放车,所以放最多的车就是求二分图的最大匹配。从头删边,如果删掉以后的最大匹配小于原最大匹配,该边就构成重... 阅读全文
posted @ 2014-04-16 16:33 LegendaryAC 阅读(408) 评论(0) 推荐(0)
HDU 4068
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4068暴力枚举两个全排列,犯了若干错误,以此为鉴#include #include #include #include using namespace std ;int n,f,m[10],vis[10],vis2... 阅读全文
posted @ 2014-04-16 00:02 LegendaryAC 阅读(181) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 ··· 19 下一页