BZOJ 4459: [Jsoi2013]丢番图 数学推导

之前绝对做过几乎一模一样的题,现在做竟然忘了.     

code: 

#include <bits/stdc++.h>  
#define ll long long     
#define setIO(s) freopen(s".in","r",stdin) 
using namespace std;  
ll n,ans=1; 
int main() 
{ 
    // setIO("input");  
    ll i,j;   
    scanf("%lld",&n); 
    for(i=2;i*i<=n;++i) 
    {   
        if(n%i==0) 
        {
            ll sum=0;   
            while(n%i==0) ++sum,n/=i;    
            ans*=2*sum+1;    
        }
    } 
    if(n>1)  ans*=3;   
    printf("%lld\n",(ans+1)/2);   
    return 0; 
}

  

posted @ 2019-12-17 20:08  EM-LGH  阅读(150)  评论(0编辑  收藏  举报