Cod sursa(job #50509)

Utilizator gabitzish1Gabriel Bitis gabitzish1 Data 7 aprilie 2007 20:18:23
Problema GFact Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.74 kb
#include<fstream.h>
#include<math.h>

long long p;
long long q, b, e, d, y;
long long a;

void citire()
{
  ifstream in("gfact.in");
  in>>p>>q;
  in.close();
}

void div(long long x)
{


  for (long long i=2; i<=x/2; i++)
    {
      if (x%i==0)
	{
	  e=0;
	  d=i;
	  while (x%i==0)
	    {
	      e++;
	      x/=i;
	    }
	}
    }
 // d=pow(d,e);
}

long long nrdiv(long long x)
{
  int r=0;
  while (x%d==0)
    {
      r++;
      x/=d;
    }
  return r;
}


void construct()
{
  long long i=1;
  while (y<e)
    {
      i++;
      y+=nrdiv(i);
    }
  ofstream out("gfact.out");
  out<<i;
  out.close();

}

int main()
{
  citire();
  p=pow(p,q);
  div(p);
  construct();
  return 0;
}