Cod sursa(job #2513120)

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

using namespace std;

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

int p, i=1;
long long s;

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

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

    return 0;
}