Cod sursa(job #473757)
| Utilizator | Data | 31 iulie 2010 19:38:21 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <fstream>
#include <iostream>
#include <stdio.h>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
long p;
int t = 0;
f >> p;
unsigned int i,y = 0,z;
for (i = 1 ; i < 64000 ; i++ )
{
z = i;
while ( z % 5 == 0 )
{
y++;
z = z / 5;
}
if ((x > y) && (y == p ))
{
g << i ;
break;
t = 1;
}
if (y > p)
{
break;
}
}
if (t==0) {
g << "-1";
}
return 0;
}
