Cod sursa(job #2075218)
| Utilizator | Data | 25 noiembrie 2017 11:58:04 | |
|---|---|---|---|
| Problema | Factorial | Scor | 45 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <iostream>
#include <cstdio>
using namespace std;
int a[100000000];
long long int p;
int zero(int x)
{
int s = 0;
while(x>5)
{
s+=x/5;
x/=5;
}
return s;
}
void rez(int lg)
{
long long i;
for(i = 100000000; lg; lg>>=1)
if(i-lg>0 && zero(i-lg) >= p)
i-=lg;
printf("%d \n", i);
}
int main()
{
long long int lg = 134217728;
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
scanf("%d", &p);
rez(lg);
return 0;
}
