Cod sursa(job #442308)
Utilizator | Data | 14 aprilie 2010 08:48:14 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int n, s, p, i = 1, j = 0;
bool ok = false;
fin >> p;
while ( !ok )
{
n *= i;
s = n;
while ( s % 10 == 0)
{
s /= 10;
j++;
}
if ( p == j )
ok = true;
else
i++;
}
fout << i;
}