上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 15 下一页
摘要: Bob has a not even coin(就是一个不均匀的硬币,朝上的概率不一定是1/2), every time he tosses the coin, the probability that the coin's front face up is q/p(q/p<=1/2). The q 阅读全文
posted @ 2017-09-17 09:37 ╰追憶似水年華ぃ╮ 阅读(626) 评论(3) 推荐(0)
摘要: 限制:1000ms 32768K Define the function S(x) for xx is a positive integer. S(x) equals to the sum of all digit of the decimal expression of x. Please fin 阅读全文
posted @ 2017-09-17 08:24 ╰追憶似水年華ぃ╮ 阅读(745) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1561 很容易想到如果是要攻克v城需要先攻克u城的话,可以建u到v的边。但是如果能够直接攻克u城呢?无边可建,这样就无法形成一棵树。因此虚拟出一个0结点去连接可直接攻克的城。这样只需多打一次0城即可。定义状态dp[ 阅读全文
posted @ 2017-09-16 09:37 ╰追憶似水年華ぃ╮ 阅读(209) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1054 给定一棵树,点能看住与其相连的边,问最少需要选定多少个点看住所有的边。 定义dp[maxn][2],dp[][0]表示不选当前顶点所获得的价值,dp[][1]表示选当前顶点所获得的价值。则: dp[u][0 阅读全文
posted @ 2017-09-16 09:29 ╰追憶似水年華ぃ╮ 阅读(196) 评论(0) 推荐(0)
摘要: hdu 6197 题意:给定一个数组,问删掉k个字符后数组是否能不减或者不增,满足要求则是magic array,否则不是。 题解:队友想的思路,感觉非常棒!既然删掉k个后不增或者不减,那么就先求数组的最长不下降子序列的长度l1和最长不上升子序列的长度l2,若l1>=n-k||l2>=n-k,则满足 阅读全文
posted @ 2017-09-13 17:09 ╰追憶似水年華ぃ╮ 阅读(176) 评论(0) 推荐(0)
摘要: 2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 H Skiing In this winter holiday, Bob has a plan for skiing at the mountain resort. This ski resort has MM different ski p 阅读全文
posted @ 2017-09-13 16:42 ╰追憶似水年華ぃ╮ 阅读(294) 评论(0) 推荐(0)
摘要: 参考博客(感谢博主):http://blog.csdn.net/yo_bc/article/details/77917288 题意: 给定一个有向无环图,求该图的最长路。 思路: 由于是有向无环图,所以最长路肯定是一个入度为0到出度为0的路径,拓扑序在确定当前点之前能够考虑到所有到它的情况,所以最后 阅读全文
posted @ 2017-09-10 10:33 ╰追憶似水年華ぃ╮ 阅读(324) 评论(0) 推荐(0)
摘要: 三角形数:an=n*(n+1)/2; 完全平方数:bn=c^2; 既是三角形数又是完全平方数:An=6*A(n-1)-A(n-2)+2; A[23]={ 0, 1, 8, 49, 288, 1681, 9800, 57121, 332928, 1940449, 11309768, 65918161, 阅读全文
posted @ 2017-09-10 09:02 ╰追憶似水年華ぃ╮ 阅读(666) 评论(0) 推荐(0)
摘要: HDU 2089 求给定区间内不含62和4的数的个数。 数位dp入门。从这里我清楚了一些数位dp的用法。比如limit是判断是否达到上界,而且需要判断(!limit).。比如若题目要求不含11的个数,举例来说:区间在[1,215],当百位开始枚举为0时,十位枚举1,个位可以取0,2~9,即dp[0] 阅读全文
posted @ 2017-09-09 10:07 ╰追憶似水年華ぃ╮ 阅读(200) 评论(0) 推荐(0)
摘要: AtCoder Regular Contest 082 D Derangement 与下标相同与下个交换就好了。。。。 Define a sequence of ’o’ and ’x’ of length N as follows: if pi ̸= i, the i-th symbol is ’o’ 阅读全文
posted @ 2017-09-02 22:03 ╰追憶似水年華ぃ╮ 阅读(168) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 15 下一页