Pagini recente » Cod sursa (job #1003280) | Cod sursa (job #1576517) | Cod sursa (job #1954504) | Cod sursa (job #1915565) | Cod sursa (job #833271)
Cod sursa(job #833271)
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
unsigned int f (unsigned int x)
{
unsigned int s=0;
while (x) {
x = x/5;
s += x;
}
return s;
}
int main()
{
unsigned int x,y;
unsigned int n;
fin >> n;
if (n>100) {
fout << "-1"<<'\n';
return 0;
}
x = 5*((4*n)/5)+1;
while (true) {
y = f(x);
fout << "\t debug x=" << x << " y=" << y << '\n';
if (y==n) {
break;
}
if (y<n) {
x = x+5;
}
else {
fout << "-1"<<'\n';
return 0;
}
}
fout << x-1 << ", " << x << ", " << x+1 << ", " << x+2 << ", " << x+3 << '\n';
return 0;
}