Cod sursa(job #274429)

Utilizator Neamtzu21Ciurea Daniel Neamtzu21 Data 9 martie 2009 18:52:40
Problema GFact Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include<iostream.h>
#include<fstream.h>

ifstream f("gfact.in");
ofstream g("gfact.out");

int q, b;
long p;

void citire()
{
     f>>p>>q;
     f.close();
     }

main()
{
      int k=2;
      while(p!=1 && q)
      {
                 while(q)
                 {
                         if(p%k==0)
                         {
                                   p/=k;
                                   q--;
                                   }
                         else k++;
                         }}
      g<<k;
      }