Pagini recente » Diferente pentru schimbare-borland/argumentatie intre reviziile 17 si 27 | Cod sursa (job #438730) | Rating Nitulescu Octavian (Miikaas12) | Cod sursa (job #447112) | Cod sursa (job #726845)
Cod sursa(job #726845)
#include<fstream>
using namespace std;
int main()
{
long long n,s,k,jk,b=0,cn,m=1;
ifstream f("fact.in");
ofstream o("fact.out");
f>>n;
s=n*5;
for(k=25;k<=s;k=k*5)
{
jk=k;
while(jk>1)
{
b++;
jk=jk/5;
}
if((s-b*5)<k)
{
o<<"-1";
m=0;
break;
}
else
s=s-5*(b-1);
}
if(n==0)
{
o<<"1";
m=0;
}
if(m==1)
o<<s;
return 0;
}