题解 | #质因数的个数#
质因数的个数
https://www.nowcoder.com/practice/20426b85f7fc4ba8b0844cc04807fbd9
#include <stdio.h> int main() { int x; while(scanf("%d", &x) != EOF) { int res = 0; for(int i = 2; i < x / i; i++) { while(x % i == 0) { res++; x /= i; } } if(x > 1) res++; //最多有一个质因数大于根号x printf("%d\n", res); } return 0; }