Cod sursa(job #277496)
Utilizator | Data | 11 martie 2009 19:23:07 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.72 kb |
#include<iostream.h>
#include<fstream.h>
long long p;
ifstream f("fact.in");
ofstream g("fact.out");
void citire()
{
f>>p;
f.close();
}
main()
{
citire();
long long h, aux, cinci=0;
if(p==0) g<<'1';
else
{
h=5;
while(cinci<p)
{
aux=h;
while(aux%5==0)
{
aux/=5;
cinci++;}
h+=5;
}
if(cinci==p) g<<h-5;
else g<<'-1';
}
g.close();
}