题解 | #质因数的个数#从2开始,只要能被整除,就一直除。
质因数的个数
https://www.nowcoder.com/practice/20426b85f7fc4ba8b0844cc04807fbd9
#include <stdio.h> int main() { int n; while (scanf("%d", &n) != EOF) { int count = 0; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { count++; n /= i; } } if (n >= 2) count++; printf("%d\n", count); } return 0; }