Pagini recente » Cod sursa (job #2961560) | Cod sursa (job #2074284) | Cod sursa (job #2762114) | Cod sursa (job #1995025) | Cod sursa (job #274022)
Cod sursa(job #274022)
#include<iostream>
#include<math.h>
#include<fstream>
using namespace std;
long long p,q,a;
ifstream f ("gfact.in");
ofstream g ("gfact.out");
int fact(long long x)
{
if(x==0||x==1) return 1;
else return x*fact(x-1);
}
int main()
{ f>>p>>q;
a=pow(p,q);
int k=1,ok=1;
while(ok&&k<=p*q) { if (fact(k)%a==0) {ok=0; g<<k;}
else k++;
}
return 0;
}