3421

/*
找规律来做的
*/

// include file
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <ctime>

#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <bitset>

#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <list>
#include <functional>

using namespace std;

// typedef
typedef __int64 LL;

// 
#define read freopen("in.txt","r",stdin)
#define write freopen("out.txt","w",stdout)

#define Z(a,b) ((a)<<(b))
#define Y(a,b) ((a)>>(b))

const double eps = 1e-6;
const double INFf = 1e100;
const int INFi = 1000000000;
const LL INFll = (LL)1<<62;
const double Pi = acos(-1.0);

template<class T> inline T sqr(T a){return a*a;}
template<class T> inline T TMAX(T x,T y)
{
	if(x>y) return x;
	return y;
}
template<class T> inline T TMIN(T x,T y)
{
	if(x<y) return x;
	return y;
}
template<class T> inline T MMAX(T x,T y,T z)
{
	return TMAX(TMAX(x,y),z);
}
template<class T> inline T MMIN(T x,T y,T z)
{
	return TMIN(TMIN(x,y),z);
}
template<class T> inline void SWAP(T &x,T &y)
{
	T t = x;
	x = y;
	y = t;
}


// code begin

// 100 = 2*2*5*5
int N;
bool P[1024*1024+1];
int stk[1024*1024],top;
LL F[30];

int main()
{
	read;
	write;
	for(int i=2;i<=(1<<20);i++)
	{
		if(!P[i])
		{
			for(int j=i+i;j<=(1<<20);j+=i)
			{
				P[j] = true;
			}
		}
	}
	top  =0;
	for(int i=2;i<=(1<<20);i++)
	{
		if(!P[i])
		{
			stk[top++] = i;
		}
	}
	
	F[1] = 1;
	for(int i=2;i<=20;i++)
	{
		F[i] = F[i-1]*i;
	}

	while(scanf("%d",&N)!=-1)
	{
		if(!P[N])
		{
			printf("1 1\n");
		}
		else
		{
			LL fenmu = 1;
			int all = 0;
			int sub = 0;
			for(int i=0;i<top;i++)
			{
				if(N%stk[i]==0)
				{
					sub = 0;
					while(N%stk[i]==0)
					{
						sub++;
						N/=stk[i];
					}
					fenmu *= F[sub];
					all+=sub;
				}

				if(N==1) break;
			}
			LL fenzi = F[all];
			printf("%d %I64d\n",all,fenzi/fenmu);
		}
	}
	return 0;
}
posted @ 2011-04-27 23:56  AC2012  阅读(255)  评论(0编辑  收藏  举报