HDU1492-The number of divisors (approx.) about Humble Numbers-number theory (count problem), divisorsnumbers-
Question link: http://acm.hdu.edu.cn/showproblem.php? Pid = 1, 1492
Question: give an idea of the number that only contains the prime factor, and calculate the approximate number: If n = p1 ^ n1 * p2 ^ n2 *... * pn ^ nn, where p1, p2 ,..., pn indicates prime factor, n1, n2 ,..., nn indicates the exponent of the corresponding prime factor. According to the multiplication principle, the number of approx. Is (n1 + 1) (n2 + 1 )... (nn + 1)
#include<iostream>#include<string>#include<cstdio>#include<cstring>#include<map>#include<queue>#include<cmath>#include<stack>#include<set>#include<vector>#include<algorithm>#define LL long long#define inf 1<<29#define s(a) scanf("%I64d",&a)#define CL(a,b) memset(a,b,sizeof(a))using namespace std;const int N=200005;__int64 n,m,a,b,c,d;int main(){ while(s(n)&&n){ a=1,b=1,c=1,d=1; while(n!=1&&n%2==0){a++,n/=2;} while(n!=1&&n%3==0){b++,n/=3;} while(n!=1&&n%5==0){c++,n/=5;} while(n!=1&&n%7==0){d++,n/=7;} printf("%I64d\n",a*b*c*d); } return 0;}
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.