Cod sursa(job #356704)

Utilizator vladutzdudevlad ungureanu vladutzdude Data 16 octombrie 2009 00:59:41
Problema GFact Scor 20
Compilator cpp Status done
Runda CNRV #2 Marime 0.37 kb
# include <fstream.h>
# include <math.h>

int main(){
	
	long long a,p,w,q,b,h;
	int i,j,ok,d;
	
	ifstream f("gfact.in");
	ofstream g("gfact.out");
	
	f>>p>>q;
	a=pow(p,q);
	d=0;
	b=1;
	ok=1;
	for(i=1;i<=1000 && ok;i++){b*=i;
	                     if(b%a==0){ok=0;
	                                 h=i;}
	}
	
	g<<h;
	
	f.close();
	g.close();
	return 0;
}