Pagini recente » Cod sursa (job #1782147) | Cod sursa (job #3155583) | Cod sursa (job #1393068) | Cod sursa (job #2090705) | Cod sursa (job #170444)
Cod sursa(job #170444)
#include<fstream>
using namespace std;
fstream f,g;
int i,n,k,x,c,ok;
int main()
{
f.open("fact.in",ios::in);
f>>k;
f.close();
g.open("fact.out",ios::out);
i=-1;
ok=1;
if(k==0) { g<<1; ok=0; }
else
{
x=0;
if (k<=5) { g<<k*5; ok=0; }
else
{
for(i=6;i<=k;i=i+6)
{
x=x+25;
n=x;
c=0;
while(n%5==0)
{
n=n/5;
c++;
}
i=i+c-2;
}
}
}
if(i==k) g<<x;
else
if(ok==1) {
{
i=i-6;
x=x+(k-i)*5;
g<<x;
}
}
g.close();
return 0;
}