Cod sursa(job #1189079)
Utilizator | Data | 21 mai 2014 11:55:09 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <fstream>
#include <iostream>
using namespace std;
ifstream f ("fact.in");
ofstream g ("fact.out");
unsigned p,k,c,cc;
int main()
{
f>>p;
if (p==0) g<<1<<'\n';
else
{
k=1;
c=5;
while (k<p)
{
cc=c;
while (cc%5==0)
{
k++;
cc=cc/5;
}
c+=5;
}
if (k==p) g<<c;
else g<<-1;;
}
return 0;
}