Pagini recente » Cod sursa (job #1066554) | Cod sursa (job #597175) | Cod sursa (job #3121633) | Cod sursa (job #346870) | Cod sursa (job #380821)
Cod sursa(job #380821)
#include<iostream>
#include<fstream>
using namespace std;
int cati5(int x)
{
int q=0;
while(x%5==0)
q++,x/=5;
return q;
}
int main()
{
int p;
ifstream fin("fact.in");
fin>>p;
fin.close();
int n=5,aux;
while(p>0)
{
//aux=cati5(n);
//p-=aux;
p--;
if(n==25)
p--;
if(n%125==0)
{
aux=cati5(n);
p-=aux-1;
}
n+=5;
}
n-=5;
ofstream fout("fact.out");
fout<<n;
fout.close();
return 0;
}