Pagini recente » Statistici Patrascoiu Andrei (andreip_ar) | Cod sursa (job #834580) | Cod sursa (job #2473476) | Cod sursa (job #2241010) | Cod sursa (job #1509600)
#include <iostream>
#include <fstream>
using namespace std;
FILE *fin=fopen("fact.in", "r");
FILE *fout=fopen("fact.out", "w");
int main()
{
int P, x, y;
fscanf(fin, "%d", &P);
x=0;
if(P==0) fprintf(fout, "1");
else{
while(P>0)
{
x=x+5;
y=x;
P--;
y=y/5;
while(y%5==0)
{
y=y/5;
P--;
}
}
if(P<0) fprintf(fout, "%d", -1);
else fprintf(fout, "%d", x);
}
return 0;
}