Pagini recente » Cod sursa (job #3166749) | Cod sursa (job #1778083) | Cod sursa (job #2098688) | Cod sursa (job #1485768) | Cod sursa (job #821410)
Cod sursa(job #821410)
#include <fstream>
//#include <iostream>
//#include <ctime>
using namespace std;
#define cout g
int c[13];
int main()
{
int P,beg,end;
//beg = clock();
ifstream f("fact.in");
ofstream g("fact.out");
f >> P;
if (P == 0)
{
cout << 0 << endl;
return 0;
}
int Z(0);
while (Z < P)
{
int i(1);
++Z;
++c[1];
while (c[i]%5 == 0)
{
++c[++i];
++Z;
}
}
//end = clock();
if (Z != P) cout << -1 << endl;
else cout << c[1]*5 << endl;
//cout << (end-beg)*1.0/CLOCKS_PER_SEC;
//cin.get();
}