Pagini recente » Cod sursa (job #3145356) | Cod sursa (job #1716597) | Cod sursa (job #2597542) | Cod sursa (job #3145416) | Cod sursa (job #2554302)
#include<iostream>
#include<fstream>
#include<limits.h>
#define fin "fact.in"
#define fout "fact.out"
//int find_nr_0(int n)
//{
//
// int aux = 5;
// int nr = 0;
// while (n >=aux)
// {
// nr += n / aux;
// aux *= 5;
// }
// return nr;
//}
//int find_number(int n)
//{
// if (n == 0)
// {
// return 1;
// }
// int left = 1, right = 2000000000;
// while (left<right)
// {
// int m = (left + right) / 2;
// int aux = find_nr_0(m);
// if (aux == n)
// {
// return m-m%5;
// }
// else
// {
// if ( aux < n)
// {
// left = m + 1;
// }
// else
// {
// right = m - 1;
// }
// }
// }
// return -1;
//}
int main()
{
std::fstream in;
int n;
in.open(fin, std::ios::in);
in >> n;
in.close();
int res = 0;
std::fstream out;
out.open(fout,std::ios::out);
if (n == 0)
{
res = 0;
}
else
{
if(n%6==5)
{
res = -1;
}
else
{
int c = n / 6;
res = (n - c) * 5;
}
}
out << res;
out.close();
return 0;
}