#include
#include
using namespace std;
int main(){
//这题的关键:
//1、是sqrt,可以极大减少复杂度,若是到方根N仍大于1,则必还有且只还有1个质因数
//2、每次瞬间整除都可帮助减少遍历范围
long M=100;
while(cin>>M)
{
long count=0;
for(long j=2;j<=sqrt(M);j++)
{
while(M%j==0)
{
M=M/j;
count++;
}
if(M<=1)break;
}
if(M>1)count++;
cout<<count<<endl;
}
return 0;
}
正整数因数的个数
猜你喜欢
转载自blog.csdn.net/weixin_40904578/article/details/87900887
今日推荐
周排行