Cod sursa(job #3211630)
Utilizator | Data | 9 martie 2024 18:20:54 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <fstream>
#include <iostream>
using namespace std;
ifstream fin ("fact.in");
ofstream fout("fact.out");
int main()
{
int n;
fin >> n;
if(n == 0) fout << 1;
else
{
for(int i = 5; ; i += 5)
{
int sum = 0, x = 5;
while(x < i)
{
sum+=i/x;
x*=5;
}
if(sum == n)
{
fout << i;
break;
}
}
}
return 0;
}