Cod sursa(job #611466)
Utilizator | Data | 1 septembrie 2011 17:58:08 | |
---|---|---|---|
Problema | Factorial | Scor | 55 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.27 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>0){n+=5;x=n;
while(x%5==0){p--;x/=5;}; };
g<<((p<0)?-1:n);
f.close();
g.close();
}