Cod sursa(job #273993)

Utilizator Neamtzu21Ciurea Daniel Neamtzu21 Data 9 martie 2009 12:19:00
Problema GFact Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include<iostream.h>
#include<fstream.h>
#include<math.h>
#include<conio.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;
    
}