标签:+= log http clu factor logs printf break 因子
就是n的所有质因子的全排列(是可重集全排列)
```cpp
typedef long long ll;
using namespace std;
ll jc[22],cnt,n,prime[N],ans,sum;
int num[N];
bool is[N];
int main()
{
jc[0]=1;
for (int i=1;i<=20;i++) jc[i]=jc[i-1]i;
for (int i=2;i<=2000;i++) is[i]=1;
for (int i=2;i<=2000;i++)
if (is[i])
{
prime[++cnt]=i;
for (int j=ii;j<=2000;j+=i)
is[j]=0;
}
while (~scanf("%lld",&n))
{
ans=0;
sum=0;
memset(num,0,sizeof(num));
for (int i=1;i<=cnt;i++)
{
if (n==1) break;
while (n%prime[i]==0) n/=prime[i],num[i]++,sum++;
}
if (n>1) sum++;
ans=jc[sum];
for (int i=1;i<=cnt;i++)
ans/=jc[num[i]];
printf("%lld %lld\n",sum,ans);
}
return 0;
}
``
标签:+= log http clu factor logs printf break 因子
原文地址:http://www.cnblogs.com/mrha/p/7929662.html