Cod sursa(job #263235)
Utilizator | Data | 20 februarie 2009 00:17:34 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include<fstream>
using namespace std;
int main()
{
int p,l,i,v[721],u,j;
ifstream cin("fact.in");
ofstream cout("fact.out");
cin>>p;
i=1;
l=0;
if(p=0)
cout<<1;
else{
for(j=5;j<=36000;j*=5)
{
++u;
v[j]=u;
}
while(l<p)
{
if(i%5==0)
for(j=5;j<=3600;j*=5)
if(i==v[j])
l+=v[j]-1;
l++;
++i;
}
cout<<i;
}
cin.close();
cout.close();
return 0;
}