Pagini recente » Cod sursa (job #2657987) | Cod sursa (job #1327353) | Cod sursa (job #2267276) | Cod sursa (job #2168292) | Cod sursa (job #2225011)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
void solve(int p)
{
int x=0;
int64_t pow5=25;
int k=0,y=2;
while(k<p) {
x+=5;
if(x==pow5) {
k+=y;
y++;
pow5*=5;
}
else
k++;
}
if(!k)
g<<1;
else if(k==p)
g<<x;
else
g<<-1;
g<<'\n';
f.close();
g.close();
}
int main()
{
int p;
f>>p;
solve(p);
return 0;
}