Cod sursa(job #1279353)
Utilizator | Data | 30 noiembrie 2014 08:38:02 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int p ,n ,m5 ,aux;
int main()
{
f>>p;
n=0;
m5=0;
if(p==0)
g<<1;
else
{
while(m5<p)
{
n=n+5;
aux=n;
while(aux%5==0)
{
aux=aux/5;
m5++;
}
}
g<<n;
}
return 0;
}