Cod sursa(job #844661)
| Utilizator | Data | 29 decembrie 2012 17:54:51 | |
|---|---|---|---|
| Problema | Factorial | Scor | 35 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include<iostream>
#include<fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int n=0,x,nr=0;
long int p;
bool ok=false;
fin>>p;
while (ok==false)
{
n++;
x=n;
while (x%5==0)
{
x/=5;
nr++;
}
if (p<nr)
{
ok=true;
n=-1;
}
if (p==nr)
{
ok=true;
}
}
fout<<n;
fin.close();
fout.close();
return 0;
}
