Cod sursa(job #2315478)
| Utilizator | Data | 9 ianuarie 2019 23:31:12 | |
|---|---|---|---|
| Problema | Factorial | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
using namespace std;
int main() {
ifstream fin("fact.in");
ofstream fout("fact.out");
long long int p,i,n,j,y;
fin>>p;
n=0;
y=0;
i=0;
while (y<p)
{
i+=5;
j=i;
n=j;
while (j%5==0)
{
y++;
j/=5;
}
}
if (y==p) fout<<n;
else fout<<"-1";
return 0;
}
