Cod sursa(job #2689444)
| Utilizator | Data | 20 decembrie 2020 20:42:51 | |
|---|---|---|---|
| Problema | Factorial | Scor | 20 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <iostream>
#include <fstream>
std::ifstream fin("fact.in");
std::ofstream fout("fact.out");
using namespace std;
int Nr5(unsigned long x)
{
int cnt=0;
while(x%5==0)
{
cnt++;
x/=5;
}
return cnt;
}
int main()
{
unsigned int N;
unsigned long long x=0;
fin >> N;
if(N==0) {
cout << 1;
return 0;
}
for(unsigned int i=0;i<N;)
{
x += 5;
i += Nr5(x);
}
fout << x;
return 0;
}
