哈希map存储,n!/a!b!c!
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
using namespace std;
map<int,int>::iterator item;
typedef long long int ll;
ll cnum(int x)
{
ll t=1;
for(int i=x;i>=1;i--)t=(ll)t*i;
return t;
}
int main()
{
int x;
while((scanf("%d",&x))!=-1)
{
map<int,int>q;
for(int i=2;i<=x&&x>1;i++)
{
if(x%i==0)
{
int s=0;
while(x%i==0)
{
s++;
x/=i;
}
q[i]+=s;
}
}
if(x>1)q[x]++;
ll ans=0;
for(item=q.begin();item!=q.end();item++)ans+=item->second;
ll res=cnum(ans);
for(item=q.begin();item!=q.end();item++)
{
ll k=cnum(item->second);
res/=k;
}
cout<<ans<<" "<<res<<endl;
};
}