Cod sursa(job #814950)

Utilizator gaby1995Calin Gabriel Iulian gaby1995 Data 16 noiembrie 2012 14:11:20
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include<iostream>
#include<fstream>
using namespace std;
int main ()
{
    ifstream f("fact.in");
    ofstream g("fact.out");
    long int n , i  , x , min;
    long long p;
    f>>p;

    if (p==0)
    g<<1;
    else if (p<5)
    g<<p*5;
    else
    {
     min=5;
     x=0;
     while(min<p)
     {
         min=min*5;
         x++;

     }
     g<<5*p-5*x;
    }
}