Cod sursa(job #2513110)

Utilizator TheShieldTheShield TheShield Data 22 decembrie 2019 13:36:20
Problema Factorial Scor 5
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.32 kb
#include <iostream>
#include <fstream>

using namespace std;

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

int p;
long long s;

int main()
{
    fin>>p;
    s=p;
    while(p>5)
    {
        s-=(p-1)/5;
        p/=5;
    }
    fout<<s*5;

    fin.close();
    fout.close();

    return 0;
}