Cod sursa(job #1364431)
| Utilizator | Data | 27 februarie 2015 17:43:38 | |
|---|---|---|---|
| Problema | Factorial | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <fstream>
using namespace std;
int main()
{int p,n,x,f;
ifstream b("fact.in");
ofstream g("fact.out");
b>>p;
n=0;
do
{
n=n+5;
x=0;
f=5;
while(f<=n)
{
x=x+n/f;
f=f*5;
}
}while(x<p);
if(x==p) g<<n;
else g<<-1;
return 0;
}
