题意:给定一个整数 n ,然后你要把它变成 1,变换操作就是随机从小于等于 n 的素数中选一个p,如果这个数是 n 的约数,那么就可以变成 n/p,否则还是本身,问你把它变成 1 的数学期望是多少. 析:一个很明显的期望DP,dp[i] 表示把 i 变成 1 的期望是多少,枚举每一种操作,列出表达式,dp[i] = ∑dp[i/x]/q + p/q*dp[i] + 1,其中 x 表示枚举的素数,然后 p 表示不是 i 的约数个数,q 是小于等于 n 的素数个数,然后变形,可以得到 dp[i] =…
Dilu have learned a new thing about integers, which is - any positive integer greater than 1 can bedivided by at least one prime number less than or equal to that number. So, he is now playing withthis property. He selects a number N. And he calls th…
Disky and Sooma, two of the biggest mega minds of Bangladesh went to a far country. They ate, coded and wandered around, even in their holidays. They passed several months in this way. But everything has an end. A holy person, Munsiji came into their…
Disky and Sooma, two of the biggest mega minds of Bangladesh went to a far country. They ate, coded and wandered around, even in their holidays. They passed several months in this way. But everything has an end. A holy person, Munsiji came into their…
UVA - 11584 Partitioning by Palindromes We say a sequence of char- acters is a palindrome if it is the same written forwards and backwards. For example, ‘racecar’ is a palindrome, but ‘fastcar’ is not. A partition of a sequence of characters is a lis…