首页 > 因数个数和
头像 重生之我是大菜狗
发表于 2023-07-21 20:47:36
我们枚举x是多少数的因子时,会发现一定是一个数大于sqrt(n),另一个小于sqrt(n) 也就是说x*y可以枚举到,但y*x是枚举不到的, 对于2来说有2*1,2*2,2*3,2*4,2*5......2*n/2 那么对于2出现了n/2对乘式,那么质因子个数为2*n/2也就是x个 展开全文
头像 耕云种月
发表于 2022-07-10 19:18:29
原题解链接:https://ac.nowcoder.com/discuss/149978 首先把因数个数和转化成倍数个数和,即 ∑i=1n⌊ni⌋\sum_{i=1}^{n}\left\lfloor\frac{n}{i}\right\rfloor∑i=1n​⌊in​⌋ 方法1: 利用 ⌊ni⌋\le 展开全文
头像 默默然诶
发表于 2022-08-04 19:08:37
#include<iostream> #include<cmath> #include<cstdio> #include<cstring> using namespace std; typedef long long ll; int main() { 展开全文