Cod sursa(job #2251372)
Utilizator | Data | 1 octombrie 2018 15:24:59 | |
---|---|---|---|
Problema | GFact | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <iostream>
#include <fstream>
using namespace std;
long long a,b,p,q;
ifstream fin("gfact.in");
ofstream fout("gfact.out");
int putere(int x,int n)
{ int rez=1;
while(n)
{
rez=rez*x;
n--;
}
return rez;
}
int main()
{ fin>>p>>q;
a=putere(p,q);
int f=1,ok=0;
for(int i=2;ok==0;i++)
{
f=f*i;
b=i;
if(f%a==0)
ok=1;
}
fout<<b;
return 0;
}