Cod sursa(job #808320)
Utilizator | Data | 6 noiembrie 2012 17:12:03 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <cstdio>
using namespace std;
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
int p;
int z=0;
int n=0;
scanf("%d",&p);
int cn;
if(p==0)
{
printf("1");
return 0;
}
while(z<=p)
{
n+=5;
cn=n;
while(cn%5==0)
{
cn/=5;
z++;
}
}
printf("%d",n-5);
return 0;
}