1 solutions

  • 1
    @ 1 week ago
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long LL;
    const int N=1e5+10;
    LL cal(LL x)
    {
    	int ans=0;
    	LL tmp=1;
    	while(x>=tmp)
    	{
    		ans++;//多了一个数
    		x-=tmp; //少了一次 
    		tmp++; //下一项 
    	}
    	return ans;
    }
    int main()
    {
    	LL n;
    	cin>>n;
    	LL ans=0;
    	for(LL i=2;i<=n/i;i++) //分解质因数 
    	{
    		if(n%i==0) //计算对应次方需要的次数 
    		{
    			int cnt=0;
    			while(n%i==0)
    			{
    				cnt++;
    				n/=i;
    			}
    			ans+=cal(cnt);
    		}
    	}
    	if(n>1)
    	{
    		ans++;//最后一个数是质数 
    	}
    	cout<<ans;
    	return 0;
    }
    
    
    • 1

    Information

    ID
    2217
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    # Submissions
    2
    Accepted
    2
    Uploaded By