Cod sursa(job #688633)

Utilizator gabrielvGabriel Vanca gabrielv Data 23 februarie 2012 18:35:40
Problema Numere 2 Scor 35
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
using namespace std;
#include<cstdio>
int main()
{
	long long n,i,e;
	freopen("numere2.in","r",stdin);
	freopen("numere2.out","w",stdout);
	scanf("%lld",&n);
	e=0;
	while(n%2==0)
	{
		n=n/2;
		e++;
	}
	if(e) 
	{
		printf("2\n%lld",e);
		return 0;
	}
	for(i=3;i*i<=n;i=i+2)
	{
		e=0;
		while(n%i==0)
		{
			n=n/i;
			e++;
		}
		if(e) 
		{
		printf("%lld\n%lld",i,e);
		return 0;
		}
	}
	printf("%lld",n);
	return 0;
}