Cod sursa(job #2437524)
Utilizator | Data | 9 iulie 2019 18:04:45 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream o("fact.out");
int n,k,P,divs;
int main()
{
f>>P;
if(P==0)
{
cout<<1;
return 0;
}k=1;
divs=25;
while(P>0)
{
n=k*5;
if(n%divs==0)
{
divs*=5;
P--;
}
k++;
P--;
}
o<<n;
return 0;
}