Cod sursa(job #1843757)
Utilizator | Ciorica Vlad vladboss2323 | Data | 9 ianuarie 2017 12:36:37 |
---|---|---|---|
Problema | GFact | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream in("gfact.in");
ofstream out("gfact.out");
int p,q,x=1,nr=0,ok=0,a;
in>>p>>q;
while(ok==0)
{
a=x;
while(a%p==0)
{
nr++;
a=a/p;
}
if(nr==q)
ok=1;
x++;
}
out<<x-1;
return 0;
}