上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 15 下一页
摘要: 通道:https://www.codechef.com/problems/PRIMEDST题意:一棵树上任取两点,问两点间距离为质数的概率思路:对于求树上的路径数的题,可以想到要用树分治,我们可以考虑经过一个点的方案数,用fft快速地求出所有方案数,然后减去来自同一颗子树的方案数代码: 1 #in... 阅读全文
posted @ 2015-07-24 16:08 mithrilhan 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.timus.ru/problem.aspx?space=1&num=1996题意:两个串A B,每个串是若干个byte,A串的每个byte的最后一个bit是可以修改的。问最少修改多少,使得B串是A的一个子串思路:前七位KMP,后面一位NlgN的hamming distan... 阅读全文
posted @ 2015-07-24 16:07 mithrilhan 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.hdu.edu.cn/showproblem.php?pid=1402题意:计算A*B代码: 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 typedef lo... 阅读全文
posted @ 2015-07-24 16:06 mithrilhan 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 通道:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3706 阅读全文
posted @ 2015-07-24 16:05 mithrilhan 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=84075#problem/D 阅读全文
posted @ 2015-07-24 16:04 mithrilhan 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=84075#problem/C题意:就是现在有一堆扑克里面的牌有无数张, 每种合数的牌有4中不同花色各一张(0, 1都不是合数), 没有质数或者大小是0或者1的牌现在这堆牌中缺失了其中的... 阅读全文
posted @ 2015-07-24 16:03 mithrilhan 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.hdu.edu.cn/showproblem.php?pid=4609题意:n条边长,求任选3条能组成三角形的概率。思路:求出res后,减去一大一下,减去都大于它的边,减去该边和其他边组成的方案。代码: 1 #include 2 #include 3 #incl... 阅读全文
posted @ 2015-07-24 15:54 mithrilhan 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.hdu.edu.cn/showproblem.php?pid=5307题意:给出n个数,然后求所有的dp[i],这里的dp[i]就是所有连续区间内和为i的区间长度总和思路:cnt[i]*sum[i]的卷积就可以了,cnt[i]代表和为i的个数,sum[i]为和为i的区间长... 阅读全文
posted @ 2015-07-23 20:06 mithrilhan 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.hdu.edu.cn/showproblem.php?pid=5296题意:给一棵n个节点的树,再给q个操作,初始集合S为空,每个操作要在一个集合S中删除或增加某些点,输出每次操作后:要使得集合中任意两点互可达所耗最小需要多少权值。(记住只能利用原来给的树边。给的树边已经... 阅读全文
posted @ 2015-07-23 18:29 mithrilhan 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.hdu.edu.cn/showproblem.php?pid=5299题意:n个不相交相切的圆,每次操作删圆及其内部的圆,不能删者败。思路:建边,然后树上SG即可。代码: 1 #include 2 #include 3 #include 4 #include... 阅读全文
posted @ 2015-07-21 21:34 mithrilhan 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.hdu.edu.cn/showproblem.php?pid=5294题意:n个点,m条边的无向图,起点1,终点n,求1到n至少删除多少条边使得走不到,和最多删除多少条边使得依然有路((删不是最短路上边的图后))。代码:裸-- 1 #include 2 #inclu... 阅读全文
posted @ 2015-07-21 18:03 mithrilhan 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 通道:http://poj.org/problem?id=2079题意:n个点选面积最大的三角形代码: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int MAX_N = 100... 阅读全文
posted @ 2015-07-20 14:33 mithrilhan 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 通道:http://codeforces.com/contest/558/problem/e题意:给出一个字符串,Q个询问,(l,r,v),将[l,r]区间升序或降序排序(v==0|v==1)思路:26颗线段树,区间更新即可。代码: 1 #include 2 #include 3 4 ... 阅读全文
posted @ 2015-07-15 12:25 mithrilhan 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.hdu.edu.cn/showproblem.php?pid=4949 阅读全文
posted @ 2015-07-14 21:12 mithrilhan 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.hdu.edu.cn/showproblem.php?pid=4804题意:用[C,D]个1×1的方格,和任意个1×2的方格去覆盖N*M的网格,有阻碍,的方法数。思路:dp[cur][j][k]:当前状态为cur,用了j个1×1的方格时状态为k的方案数。代码: 1 #in... 阅读全文
posted @ 2015-07-14 21:10 mithrilhan 阅读(202) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 15 下一页