Cod sursa(job #1712997)
Utilizator | Data | 4 iunie 2016 14:34:56 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include <iostream>
using namespace std;
int nzero(int x)
{
int ans=0,p5=5;
while(x>=p5)
{
ans+=x/p5;
p5=p5*5;
}
return ans;
}
int main()
{
int p,n=1;
cin>>p;
while(nzero(n)<p)n++;
if (nzero(n)==p) cout << n;
else cout <<-1;
return 0;
}