Cod sursa(job #702609)
Utilizator | Data | 2 martie 2012 00:16:18 | |
---|---|---|---|
Problema | Factorial | Scor | 65 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <fstream>
using namespace std;
long long p;
int n;
void citire()
{
ifstream f;
f.open("fact.in");
f>>p;
f.close();
}
void rez()
{
int i=0;
long long nr=0;
ofstream g;
g.open("fact.out");
while (nr<p)
{
i++;
n=i;
nr++;
while (n%5==0)
{
n/=5;
nr++;
}
}
if (nr==p) g<<(i*5);
else g<<-1;
}
int main(void)
{
citire();
rez();
return 0;
}