Cod sursa(job #274001)

Utilizator cryowarCristian Barbu cryowar Data 9 martie 2009 12:26:25
Problema GFact Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include<iostream>
#include<math.h>
#include<fstream>

using namespace std;
long long p,a,q,b;



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;
              for(long long i=1;i<=p*q && k;i++) if(fact(i) % a==0) {k=0;b=i;}
      
              g<<b<<endl;
g<<fact(34)<<endl<<a;

return 0;
}