Cod sursa(job #1066731)
Utilizator | Data | 25 decembrie 2013 15:19:00 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include<fstream>
using namespace std;
fstream f("fact.in",ios::in);
fstream g("fact.out",ios::out);
int numar(long n)
{
long x,i,y;
x=1;
y=0;
for(i=1;i<=n;i++)
if(i%2==0 || i%5==0)
{x=x*i;
if(x%10==0)
{
y++;
x=x/10;}}
return y;
}
int main()
{
long p,n;
f>>p;
if(p==0)
g<<1;
else
{n=1;
while(numar(n)!=p)
n++;
g<<n;}
return 0;}