Pagini recente » Diferente pentru problema/expand intre reviziile 7 si 6 | Cod sursa (job #1746177) | Cod sursa (job #1537783) | Cod sursa (job #1511527) | Cod sursa (job #1171486)
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int n,x,p;
long long pas;
fin>>p;
if(p==0) fout<<1;
else if(p==1) fout<<5;
else if(p==2) fout<<10;
else
{
n=2;
pas=10;
for(;;)
{
pas+=5;
x=pas;
while(x%5==0) x/=5,n++;
if(n>p) {fout<<-1;;break;}
else if(n==p) {fout<<pas;break;}
}
}
}