Cod sursa(job #679595)
| Utilizator | Data | 13 februarie 2012 15:38:38 | |
|---|---|---|---|
| Problema | Factorial | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <fstream>
using namespace std;
int i = 5, o, p;
int main()
{
long count = 0;
bool stupid = false;
ifstream f ("fact.in");
ofstream g ("fact.out");
f >> p;
if(p != 0)
{
while(1)
{
o = i;
while(o % 5 == 0)
{
o /= 5;
count ++;
}
if(count >= p)
{
if(count == p)
break;
else
{
stupid = true;
break;
}
}
i += 5;
}
if(!stupid)
g << i;
else
g << "-1";
}
else
g << "1";
}