Cod sursa(job #1399700)
Utilizator | Data | 24 martie 2015 21:26:13 | |
---|---|---|---|
Problema | Factorial | Scor | 80 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int x,p,y,i,j,nr;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
x=5*p;
y=p;
if (p==0)
g<<1;
else
{
for (i=5;i<=y;i+=5)
{
j=i;
while (j%5==0)
{
j=j/5;
x-=5;
y--;
}
}
g<<x;
}
return 0;
}