Cod sursa(job #2250760)
Utilizator | Data | 30 septembrie 2018 17:33:12 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
long long p,i,x;
fin>>p;
if(p==1)
cout<<0;
else
{
for(i=5;p!=0;i+=5)
{ x=i;
while(x%5==0)
{p--;x=x/5;}
}
fout<<i-5;
}
return 0;
}