Cod sursa(job #656629)
Utilizator | Data | 4 ianuarie 2012 21:20:30 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include<iostream>
#include<fstream>
using namespace std;
std::ifstream f("fact.in");
std::ofstream g("fact.out");
long nrz( long c )
{
long p = 0;
while( c )
{
p += c/5;
c /= 5;
}
return p;
}
int main(void){
long int x=1,i=2,p,j;
f>>p;
if(p==0)
g<<1;
else if((p%2==1)&& (p==1))
g<<-1;
else
{
g<<nrz(p);
}
return 0;
}