Cod sursa(job #2480485)
Utilizator | Data | 25 octombrie 2019 17:40:31 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <fstream>
#include <iostream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main(){
int p, n = 0, aux;
in >> p;
if(!p){
out << -1;
return 0;
}
while(p > 0){
n += 5;
aux = n;
while(!(aux % 5)){
aux /= 5;
p--;
}
}
if(!p) out << n;
else out << -1;
return 0;
}