Cod sursa(job #1113977)

Utilizator Valy333Hojbota Valy Valy333 Data 21 februarie 2014 09:21:47
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
    long int n=0,p,aux=0,f=0,nr=0;
    in>>p;
    while (aux<p)
    {
        nr=n+5;
        n=nr;
        aux++;
        f=aux;
        while (f%5==0)
        {
              f=f/5;
              aux++;
        }
        if (aux>=p)
             n=-1;            
    }
    out<<n;
    return 0;
}