Cod sursa(job #2229928)
Utilizator | Data | 8 august 2018 14:43:20 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
unsigned long long p, n;
int i;
fin>>p;
if(p==0) fout<<1;
else{
for(i=5; p > 1; i=i+5){
n = i;
while(n%5==0){
--p;
n = n/5;
}
}
}
fout<<i;
}