Cod sursa(job #2285878)
Utilizator | Data | 19 noiembrie 2018 14:44:33 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int k,num,fact=0,cfact,ctr=1;
int main()
{
f >> k;
if (k==0)
g << 1;
else {
while (num!=k) {
fact=5*ctr;
cfact=fact;
while (cfact%5==0) {
num++;
cfact/=5;
}
ctr++;
}
g << fact;
}
return 0;
}