Cod sursa(job #1424111)
Utilizator | Data | 23 aprilie 2015 15:26:53 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f ("fact.in");
ofstream g ("fact.out");
int main()
{
int n,i,c,cop;
f>>n;
if(n==0)
g<<0;
else if(n==5)
g<<-1;
else
{
c=0;
while(n>0)
{
c+=5;
cop=c;
while(cop%5==0)
{
cop=cop/5;
n--;
}
}
g<<c;
}
return 0;
}