Cod sursa(job #1103938)
Utilizator | Data | 10 februarie 2014 09:48:20 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream input("fact.in");
ofstream output("fact.out");
long p, n=0, m, c5 = 0;
input >> p;
while (c5 != p)
{
n += 5;
m = n;
m = m / 5;
c5++;
while (m % 5 == 0)
{
m /= 5 ;
c5++;
}
}
output << n<<endl;
}