Cod sursa(job #212238)
| Utilizator | Data | 4 octombrie 2008 20:08:40 | |
|---|---|---|---|
| Problema | Factorial | Scor | 25 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<stdio.h>
long p;
long long unsigned i,sol;
int fact(int a)
{
long s=0;
while(a>1)
{a=a/5;
s=s+a;
}
return s;
}
void solve()
{
scanf("%ld",&p);
for(i=0;i<=-1;i=i+5) if(fact(i)>=p){sol=i;break;}
if (sol==0) printf("1");
else printf("%ld",sol);
}
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
solve();
return 0;
}