Cod sursa(job #1220349)
| Utilizator | Data | 17 august 2014 02:48:06 | |
|---|---|---|---|
| Problema | Factorial | Scor | 5 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <iostream>
#include <math.h>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
double p;
f>>p;
double x = 1, f;
while (x != 0)
{
f = 1;
for (int i = 1; i <= x; i ++)
{
f = f * i;
}
g<<f<<"\n";
double y = pow(10, p);
if ((int)floor(f) % (int)floor(y) == 0)
{
g<<x - 1;
x = 0;
}
else
{
x = x + 1;
}
}
return 0;
}
