Cod sursa(job #1011915)
Utilizator | Data | 17 octombrie 2013 19:13:39 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <cstdio>
#include <cstdlib>
#define fr(i, a, b) for(int i=0; i<a; ++i)
int main()
{
int p, s, n = 0;
int ketto = 0, ot = 0;
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
scanf("%d", &p);
while (true)
{
++n;
s = n;
while(s%5==0)
{
++ot;
if (ot==p) break;
s /= 5;
}
if (ot==p) break;
}
printf("%d", n);
return 0;
}