Cod sursa(job #829231)

Utilizator RaresGabrielMircea Rares-Gabriel RaresGabriel Data 4 decembrie 2012 22:41:46
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include<iostream>
#include<cmath>
#include<climits>
#include<fstream>

using namespace std;

ifstream fin("fact.in");
ofstream fout("fact.out");

int main () {
    int i,p,k=0,n;
    fin >> p;
    if(p==0)fout<<"1";
    else{
    for (i=5;p>0;i=i+5){
               n=i;
               while(n%5==0){n=n/5;
                                         k--;}
                           }
    }
               if(p<0)fout<<"-1";
                  else fout<<i-5;

    fin.close();
	fout.close();

	return 0;

}