Pagini recente » Cod sursa (job #1284134) | Cod sursa (job #377169) | Cod sursa (job #168018) | Diferente pentru problema/divmul intre reviziile 2 si 1 | Cod sursa (job #2914496)
#include <fstream>
using namespace std;
int find(int p) {
int i = 0;
int aux = 0;
if (p == 0)
return 1;
do {
i = i + 5;
aux = i;
while (aux % 5 == 0){
p--;
aux = aux / 5;
}
if (p < 0)
return -1;
} while (p > 0);
return i;
}
int main() {
ifstream fin("fact.in");
ofstream fout("fact.out");
int p;
fin>>p;
int n = find(p);
fout<<n;
return 0;
}