Cod sursa(job #2282974)
Utilizator | Data | 14 noiembrie 2018 19:56:37 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int n, i = 1, cnt = 0, x;
long long k;
fin >> k;
if(k == 0)
{
fout << 1;
return 0;
}
while(cnt < k)
{
x = i;
while(x % 5 == 0)
{
cnt++;
x /= 5;
}
i++;
}
fout << i - 1;
return 0;
}