Cod sursa(job #291568)

Utilizator vlasceanuVlasceanu Razvan vlasceanu Data 30 martie 2009 00:03:09
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <cstdlib>
#include <iostream>
#include <limits>
using namespace std;

unsigned long int Ev(unsigned long int p)
{
 if (p==0) return 1;
 unsigned long int aux=5;    
 unsigned long int rez = p*5;
 while(aux*5<p*5)
 {rez-=5;
 aux*=5;}
 return rez;
}


int main(int argc, char *argv[])
{
    
    long unsigned int pp;
    freopen("fact.in","r",stdin);
    cin >> pp;   
    fclose(stdin);
    freopen("fact.out","w",stdout);
    cout<<Ev(pp);
    fclose(stdout);
    return EXIT_SUCCESS;
}