Cod sursa(job #611517)
Utilizator | Data | 1 septembrie 2011 20:26:56 | |
---|---|---|---|
Problema | Factorial | Scor | 75 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include <fstream>
std::ifstream f;
std::ofstream g;
int main(){
register int p,n=0,x;
f.open("fact.in");
g.open("fact.out");
f>>p;
while(p-4>0){n+=25;x=n;p-=4;
while(x%5==0){p--;x/=5;};};
if(p>0)n+=(p*5);
g<<((p<0)?-1:n);
f.close();
g.close();
}