Cod sursa(job #828874)
Utilizator | Data | 4 decembrie 2012 16:24:38 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include<iostream>
#include<cmath>
#include<fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main () {
int p,k=0,n=0,y=0;
fin>>p;
while(n!=p){y=y+5;
k=y;
while(k%5==0){k=k/5;
n++;}
}
if(n!=p||p<0)fout<<"-1";
else fout<<y;
fin.close();
fout.close();
return 0;
}