Cod sursa(job #657498)

Utilizator teo721Pavel Teo teo721 Data 6 ianuarie 2012 17:47:16
Problema GFact Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
    int i,p,q,aux,contor=0;
    fstream f("gfact.in",ios::in);
    f>>p>>q;
    f.close();
    i=1;
    while(contor<q)
    {
      aux=i;
      while(aux%p==0)
      {
        aux/=p;
        contor++;
        }
        i++;
        }
    fstream g("gfact.out",ios::out);
    g<<i-1;
}