Pagini recente » Cod sursa (job #797) | Clasament way_to_death | Cod sursa (job #1183576) | Cod sursa (job #2229864) | Cod sursa (job #2078108)
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main( )
{
long long p;
int nrZero;
fin >> p;
bool gasit = false;
if( p == 0 ){
fout << 1;
return 0;
}
for( long long i = p * 4 ; i <= 20 ; ++i ){
nrZero = 0;
for( int j = 5 ; j <= i ; j *= 5 ){
nrZero += i / j;
}
if( nrZero == p ){
gasit = true;
fout << i;
break;
}
}
if( !gasit ) fout << -1;
}