Cod sursa(job #273983)
Utilizator | Data | 9 martie 2009 12:13:30 | |
---|---|---|---|
Problema | GFact | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<iostream.h>
#include<math.h>
#include<fstream.h>
long long p,a;
int q;
long b;
ifstream f ("gfact.in");
ofstream g ("gfact.out");
int fact(int x)
{
if(x==0||x==1) return 1;
else return x*fact(x-1);
}
main()
{ f>>p>>q;
a=pow(p,q);
int k=1;
for(int i=1;i<=fact(p*q) && k;i++) if(fact(i) % a==0) {k=0;b=i;}
g<<b;
}