Pagini recente » Istoria paginii runda/gg | Cod sursa (job #733428) | Cod sursa (job #1157576) | Monitorul de evaluare | Cod sursa (job #1739904)
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int p, q;
ifstream in("gfact.in");
ofstream out("gfact.out");
in >> p >> q;
int numar = 1, numar_aux;
if(p == 1)
out << 1;
else
{
while(q > 0)
{
numar++;
numar_aux = numar;
while(numar_aux % p == 0 && q > 0)
{
numar_aux = numar_aux / p;
q--;
}
}
}
out << numar;
in.close();
out.close();
return 0;
}