Cod sursa(job #1113996)
Utilizator | Data | 21 februarie 2014 09:35:18 | |
---|---|---|---|
Problema | Factorial | Scor | 55 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
long int x,p,aux=0,f=0,nr=0;
in>>p;
while (aux<p)
{
nr=nr+5;
aux++;
f++;
x=f;
while (x%5==0)
{
x=x/5;
aux++;
}
}
if (aux>p)
nr=-1;
out<<nr;
return 0;
}