Cod sursa(job #1101297)

Utilizator PopIonPop Ion PopIon Data 8 februarie 2014 11:29:42
Problema Factorial Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.33 kb
#include <fstream>

using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{unsigned long P,N,k;
f>>P;
if(P==0)
    g<<1;
else
{ N=5;
while(P)
{k=N;
   while(k%5==0)
   {
       P--;
       k=k/5;
   }
   N=N+5;}
   N-=5;
    g<<N;
}
    g.close ();
    f.close ();
    return 0;
}