Cod sursa(job #356268)
Utilizator | Data | 13 octombrie 2009 23:19:43 | |
---|---|---|---|
Problema | GFact | Scor | 20 |
Compilator | cpp | Status | done |
Runda | CNRV #2 | Marime | 0.33 kb |
# include <fstream.h>
# include <math.h>
int main(){
long long a,p,w,q,b;
int i,j,ok,d;
ifstream f("gfact.in");
ofstream g("gfact.out");
f>>p>>q;
a=pow(p,q);
ok=1;d=0;
w=1;
while(w%a!=0){b=1;
d++;
for(i=1;i<=d;i++)b*=i;
w=b;}
g<<d;
f.close();
g.close();
return 0;
}