Cod sursa(job #1247729)
Utilizator | Data | 23 octombrie 2014 15:24:53 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
using namespace std;
int zero (int n)
{
int rez;
rez=0;
while(n>=5)
{
rez+=n/5;
n/=5;
}
return rez;
}
int main()
{
int n, p, min, i;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
f.close();
min=5;
while(zero(min)!=p)
min+=5;
g<<min;
return 0;
}