Cod sursa(job #611507)

Utilizator Luncasu_VictorVictor Luncasu Luncasu_Victor Data 1 septembrie 2011 19:30:42
Problema Factorial Scor 55
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.29 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;
    if(x%25==0)
    while(x%5==0){p--;x/=5;}else p--; };
    g<<((p<0)?-1:n);
    f.close();
    g.close();
}