Pagini recente » Cod sursa (job #2501908) | Cod sursa (job #3156760) | Cod sursa (job #744602) | Cod sursa (job #817241) | Cod sursa (job #869855)
Cod sursa(job #869855)
#include <fstream>
#include <iostream>
using namespace std;
int main ( )
{
int P;
ifstream fin ("fact.in");
fin >> P;
long long int x = 1;
int nrz = 0;
int N;
if ( P == 0 )
N = 1;
else
for ( int i = 1 ; i < 100000000 ; ++ i )
{
x = x * i;
if ( x % 10 == 0 )
{
++ nrz;
x /= 10;
}
if ( nrz == P )
{
N = i;
break;
}
}
ofstream fout ("fact.out");
fout << N;
fin.close ();
fout.close ();
return 0;
}