题意:现在有一个数写在黑板上,它以等概率转化为它的一个约数,可以是1,问经过k次转化后这个数的期望值 题解:如果这个数是一个素数的n次方,那么显然可以用动态规划来求这个数的答案,否则的话,就对每个素因数求答案,再相乘 参考博客:https://www.cnblogs.com/birchtree/p/10234203.html ac代码: #include<bits/stdc++.h> #define ll long long #define pa pair<int,int> usi…
Makoto has a big blackboard with a positive integer n written on it. He will perform the following action exactly k times: Suppose the number currently written on the blackboard is v . He will randomly pick one of the divisors of v (possibly 1 and v)…
又回来了.. A - Gennady and a Card Game 好像没什么可说的了. #include<bits/stdc++.h> using namespace std; char gc() { static char buf[100000],*p1,*p2; return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,100000,stdin))?EOF:*p1++; return getchar(); } template<class…
Codeforces 878 E. Numbers on the blackboard 解题思路 有一种最优策略是每次选择最后面一个大于等于 \(0\) 的元素进行合并,这样做完以后相当于给这个元素乘 \(2\) ,并且不使前面一个元素的值增加了.但是按照这样的策略做不太好维护,考虑做完以后有许多块,除了第一个块以外每一个块都是负的,然后将这些块与第一个块合并.那么用并查集维护一下每个块,每一个元素被乘 \(2\) 的次数就是这个块里面位置比它小的元素个数.定义一个块的和为每个元素乘上其对应系数…
Makoto and a Blackboard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Makoto has a big blackboard with a positive integer nn written on it. He will perform the following action exactly k…