Cod sursa(job #2062291)
Utilizator | Data | 10 noiembrie 2017 10:37:39 | |
---|---|---|---|
Problema | Factorial | Scor | 45 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
int n, i, x, cx;
f >> n;
x = 0;
for ( i = 0 ; i < n; i++) {
x += 5;
cx = x / 5;
while ( cx % 5 == 0 ) {
cx /= 5;
i++;
}
}
if ( x == 0 )
g << "1";
else
g << x;
return 0;
}