Cod sursa(job #2836117)
Utilizator | Data | 19 ianuarie 2022 19:35:59 | |
---|---|---|---|
Problema | Factorial | Scor | 50 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <fstream>
using namespace std;
ifstream cin("fact.in");
ofstream cout("fact.out");
int main()
{
int p,ct=0,n=5,x;
cin>>p;
if(p==0)
{
cout<<1;
return 0;
}
while(ct<p)
{
x=n;
while(x%5==0)
{
ct++;
x/=5;
}
n+=5;
}
if(p==ct)
cout<<n-5;
else
cout<<-1;
return 0;
}