Cod sursa(job #1446620)
Utilizator | Data | 2 iunie 2015 13:26:23 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int n,x,c,p;
int main()
{
fin>>n;
if(n==0)fout<<1;
else{
while(x<n)
{
p+=5;c=p;
while(c%5==0){c/=5;x++;}
}
if(x>n)fout<<-1;
else fout<<p;}
fout<<'\n';
fin.close();
fout.close();
return 0;
}