Cod sursa(job #805017)

Utilizator TwistedFaithStanescu Jean Alexandru TwistedFaith Data 30 octombrie 2012 20:16:24
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=25,h; int k,x=1;

int main()
{

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

    fin>>P;

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