Cod sursa(job #291564)

Utilizator vlasceanuVlasceanu Razvan vlasceanu Data 29 martie 2009 23:37:25
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.72 kb
#include <cstdlib>
#include <iostream>
#include <limits>
using namespace std;

long unsigned int Ev(long unsigned p)
{
 if (p==0) return 1;
 if (p<5) return 5*p;
 if (p<25) return 5*(p-1);
 if (p<125) return 5*(p-2);
 if (p<625) return 5*(p-3);
 if (p<3125) return 5*(p-4);
 if (p<15625) return 5*(p-5);
 if (p<78125) return 5*(p-6);    
 if (p<390625) return 5*(p-7);
 if (p<1953125) return 5*(p-8);
 if (p<9765625) return 5*(p-9);else return 5*(p-10); 
}


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