Cod sursa(job #918694)
Utilizator | Data | 19 martie 2013 07:40:50 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int zero(int x)
{
int i,a=0,b=0,j;
for(i=1;i<=x;i++)
{
j=i;
while(j%2==0) {a++; j=j/2;}
while(j%5==0) {b++; j=j/5;}
}
if (a>b) return b;
return a;
}
int main()
{
int p,i,n=1;
f>>p;
while(zero(n)!=p) n++;
g<<n;
return 0;
}