Cod sursa(job #1936773)
Utilizator | Data | 23 martie 2017 13:27:39 | |
---|---|---|---|
Problema | GFact | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <iostream>
#include <fstream>
using namespace std;
int p,q,n,nr=0,x;
int main()
{
ifstream f("gfact.in");
ofstream g("gfact.out");
f>>p>>q;
n=p;
while (1)
{
x=n;
while (x%p==0)
{
nr++;
x=x/p;
}
if (nr>=q) {g <<n; break;}
n=n+p;
}
return 0;
}