Pagini recente » Cod sursa (job #1790834) | Diferente pentru problema/curcubeu intre reviziile 7 si 8 | Cod sursa (job #1682095) | Cod sursa (job #2514091) | Cod sursa (job #2309070)
#include <bits/stdc++.h>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int n;
long long r,pas;
int zero(int x)
{
int ans=0;
while(x>=5)
{
ans+=x/5;
x=x/5;
}
return ans;
}
int main()
{
f>>n;
pas=1<<30;
r=0;
while(pas)
{
if(zero(r+pas)<n)r+=pas;
pas/=2;
}
if(zero(r+1)==n)
g<<r+1<<'\n';
else g<<-1;
return 0;
}