1 solutions

  • 0
    @ 2025-12-4 15:38:50
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long LL;
    int cal(int x) //计算从1开始最多可以加多少个数小于等于x
    {
    	int ans=0;
    	int temp=1;
    	while(temp<=x)
    	{
    		ans++;
    		x-=temp;
    		temp++;
    	}
    	return ans;
    }
    int main()
    {
    	LL n;
    	cin>>n;
    	map<LL,int> h; //分解质因数
    	for(int i=2;i<=n/i;i++)
    	{
    		while(n%i==0)
    		{
    			h[i]++;
    			n/=i;
    		}
    	}
    	if(n>1) h[n]++;
    	int ans=0;
    	for(auto it:h)
    	{
    		ans+=cal(it.second);
    	}
    	cout<<ans;
    	return 0;
    }
    
    • 1

    Information

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