[数学] BZOJ 4459 [Jsoi2013]丢番图


就是个类似求n^2因子个数的东西


#include<cstdio>  
#include<cstdlib>  
using namespace std;
typedef long long ll;
  
ll n,ans;  

int main()
{   
	freopen("t.in","r",stdin);
	freopen("t.out","w",stdout);
	ll ans=1;  
    scanf("%lld",&n); 
    for (int i=2;(ll)i*i<=n; i++) 
		if (n%i==0)
		{  
        	int cnt=0;  
        	for (;n%i==0;n/=i) cnt++;  
        	ans*=cnt<<1|1;  
    	}  
    if (n>1) ans*=3;  
    printf("%lld\n",(ans+1)>>1);  
	return 0;
}  




你可能感兴趣的:([数学] BZOJ 4459 [Jsoi2013]丢番图)