Cod sursa(job #2781402)
Utilizator | Data | 9 octombrie 2021 13:24:55 | |
---|---|---|---|
Problema | Factorial | Scor | 30 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream fin ("fact.in");
ofstream fout ("fact.out");
int p,x,nr5=0;
fin>>p;
if(p==0)
{
fout<<1;
}
else
{
nr5=1;
for(x=5;nr5<p;x+=5)
{
int copx=x;
while(copx!=0 && copx%5==0)
{
copx/=5;
nr5++;
}
}
fout<<x;
}
return 0;
}