Pagini recente » Rating Adrian Seres (adrianseri) | Cod sursa (job #2533606) | Istoria paginii runda/delaceorashimulare | Cod sursa (job #2450734) | Cod sursa (job #588490)
Cod sursa(job #588490)
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
int b,a,p,N=5;bool ok=false;
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>p;
while (ok==false)
{
if (p==0)
{
fout<<"1"<<endl;
ok=true;
}
else
{
a=0;
if (p>=a)
{
for (int i=0;i<=N;i=i+5)
{
b=i;
while (b>=5)
{
if (b%5==0)
{
a++;
}
b=b/5;
}
}
if (p==a)
{
fout<<N;
ok=true;
}
N=N+5;
}
else
{
fout<<"-1"<<endl;
ok=true;
}
}
}
return 0;
}