Cod sursa(job #2577190)
Utilizator | Data | 8 martie 2020 17:15:40 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
int copie,pow,k,p,i=0;
in>>p;
if(p==0) out<<1;
else
{
while(p>4)
{
i+=5;
pow=0;
copie=i;
while(copie%5==0)
{
copie=copie/5;
pow++;
}
p-=pow;
}
out<<i;
}
}