Cod sursa(job #2664583)
Utilizator | Data | 28 octombrie 2020 20:57:57 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include "bits/stdc++.h"
using namespace std;
long zero ( long a)
{
long s = 0;
long b = 5;
while (a >= b) {
s += a/b;
b *= 5;
}
return s;
}
int main()
{
ifstream cin("fact.in");
ofstream cout("fact.out");
long p;
cin >> p;
long c = 1;
while (zero(c) < p) {
c++;
}
if (zero(c) != p) {
cout << -1;
}
else
cout << c;
return 0;
}