Cod sursa(job #274003)

Utilizator Neamtzu21Ciurea Daniel Neamtzu21 Data 9 martie 2009 12:27:40
Problema GFact Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 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;

}