Cod sursa(job #804999)

Utilizator TwistedFaithStanescu Jean Alexandru TwistedFaith Data 30 octombrie 2012 19:57:57
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include <iostream>
#include <fstream>

using namespace std;

long int P,i,x=25; int k;

int main()
{

    ifstream fin("fact.in");
    ofstream fout("fact.out");

    fin>>P;
    if(P==0) fout<<1;
    else
    {
        while(i/5<P)
        {
            if(i==x) {k++; x*=5;}
            i+=5;
        }
        fout<<i-5*k;
    }
}