摘要: 通道:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4898题意:就是现在给出N个数, 然后给出M个数询问这M书中有多少个可以是由这N个数中... 阅读全文
posted @ 2015-07-24 16:12 mithrilhan 阅读(359) 评论(0) 推荐(0) 编辑
摘要: 通道:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2672题意:两个只包含字符'a', 'b'的字符串A和B, 求A的子串中与B的Hamm... 阅读全文
posted @ 2015-07-24 16:11 mithrilhan 阅读(407) 评论(0) 推荐(0) 编辑
摘要: 通道:https://www.codechef.com/problems/COUNTARI题意:给出一个数列num[1..n], 每个数都是不超过30000的正整数, 现在求有多少个三元组(i, j, k)满足 1 2 #include 3 #include 4 #include 5... 阅读全文
posted @ 2015-07-24 16:09 mithrilhan 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.zju.edu.cn/onlinejudge/showProBlem.do?proBlemCode=3856题意:最多使用三个素数做加法和乘法(无括号),问得到X有多少种方案思路:6种情况:1、A,O(1)判断2、A+B, FFT处理3、A*B,lgN*lgN判断4、A*... 阅读全文
posted @ 2015-07-24 16:09 mithrilhan 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 通道: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) 编辑