Cod sursa(job #1009543)
Utilizator | Data | 13 octombrie 2013 13:39:52 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream IN ("fact.in");
ofstream OUT ("fact.out");
int p; IN >> p;
int noo5 = 0, index = 0, check;
if (p == 0)
{
OUT << "1\n";
return 0;
}
else
{
while (noo5 < p)
{
index += 5;
check = index;
while (check % 5 == 0)
{
check /= 5;
/*if (check > 0)
noo5++;*/
noo5++;
}
}
}
OUT << index << "\n";
return 0;
}