Cod sursa(job #2296906)
Utilizator | Data | 5 decembrie 2018 08:23:18 | |
---|---|---|---|
Problema | Factorial | Scor | 30 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int p, ap=1, res=5;
int main()
{
fin>>p;
if(p==0)
{
fout<<"1\n";
return 0;
}
while(ap<p)
{
res=res+5;
int copie=res;
while(copie%5==0)
{
ap++;
copie=copie/5;
}
}
fout<<res<<'\n';
return 0;
}