Pagini recente » Cod sursa (job #2181771) | Cod sursa (job #1550745) | Cod sursa (job #948679) | Cod sursa (job #743987) | 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;
}