Description
Your task in this problem is to determine the number of divisors of Cnk. Just for fun -- or do you need any special reason for such a useful computation?
Input
The input consists of several instances. Each instance consists of a single line containing two integers n and k (0 ≤ k ≤ n ≤ 431), separated by a single space.
Output
For each instance, output a line containing exactly one integer -- the number of distinct divisors of Cnk. For the input instances, this number does not exceed 2 63 - 1.
Sample Input
5 16 310 4
Sample Output
2616
分析:一个数的因子个数求法 将数写成 n=p1^a*p2^b..pn^c; 也就是质因素乘积的形式 那么因子的个数就是 sum=(a+1)*(b+1)*...*(c+1);
code:
View Code
#include#include int p[90]; int v[432]; int pn; int e[432][90]; void pri() { int i,j; pn=0; memset(v,0,sizeof(v)); for(i=2;i<=431;i++) { if(v[i]==0) { p[pn++]=i; for(j=i;j<=431;j+=i) v[j]=1; } } } void fac() { int i,j,k; for(i=2;i<=431;i++) { k=i; for(j=0;j 1&&k%p[j]==0) { e[i][j]++; k/=p[j];} } for(i=3;i<=431;i++) for(j=0;j