摘要: http://acm.fzu.edu.cn/problem.php?pid=2132N个数已经排成非递减顺序,那么每次可以取 前m->n个在x前面.取前m个在x前面的概率是 C(n,m)*x^m*(1-x)^(n-m)依次递推即可. 1 #include 2 #include 3 #inclu... 阅读全文
posted @ 2015-06-11 19:33 NowAndForever 阅读(135) 评论(0) 推荐(0) 编辑
摘要: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1010http://poj.org/problem?id=1338首先poj这题要找出第n个丑数,想到要打表,因为每一个丑数都是由前一个丑数*2或者*3或者*5得到,每次取3... 阅读全文
posted @ 2015-06-11 15:08 NowAndForever 阅读(225) 评论(0) 推荐(0) 编辑
摘要: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1095竟然错了10次,最后还是用字典树搞过去的,不过这题解法很多,二分,哈希,STL,排序 都可以搞。字典树建树的时候保存节点出现的次数,因为可能大小写都有,所以开next[... 阅读全文
posted @ 2015-06-11 11:16 NowAndForever 阅读(475) 评论(2) 推荐(0) 编辑
摘要: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1126http://acm.hdu.edu.cn/showproblem.php?pid=1005注意上面一题和下面一题的区别,上面A,B可能取负数,但是mod跟c++中%是... 阅读全文
posted @ 2015-06-11 11:08 NowAndForever 阅读(375) 评论(0) 推荐(0) 编辑