Cod sursa(job #273995)
Utilizator | Data | 9 martie 2009 12:19:39 | |
---|---|---|---|
Problema | GFact | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include<iostream.h>
#include<fstream.h>
#include<math.h>
int b,k,q;
long a,p;
ifstream f("gfact.in");
ofstream g("gfact.out");
void citire()
{
f>>p>>q;
f.close();
}
main()
{
citire();
long prod=2;
float k;
int b=2;
a=pow(p,q);
k=prod%a;
int gasit=1;
while(k)
{
b++;
prod=prod*b;
k=prod%a;
}
g<<b;
}