Cod sursa(job #356699)
Utilizator | Data | 15 octombrie 2009 23:40:29 | |
---|---|---|---|
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);
ok=1;d=0;
w=1;
ok=1;
while(ok){b=1;
for(i=1;i<=d;i++)b*=i;
if(b%a==0){ok=0;
h=d;}d++;
}
g<<h;
f.close();
g.close();
return 0;
}