Cod sursa(job #1101275)

Utilizator PopIonPop Ion PopIon Data 8 februarie 2014 10:31:02
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include <fstream>

using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{long long P,N,k,p1,i=5;
f>>P;
if(P==0)
    g<<1;
else
{
    p1=5*P;
    k=5*P;
    while(i*5<k)
    {
        p1=p1-5;
        i=i*5;
    }
    g<<p1;
}
    g.close ();
    f.close ();
    return 0;
}