Cod sursa(job #266784)

Utilizator skatesZaharescu Dragos skates Data 26 februarie 2009 08:47:57
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include<iostream.h>   
#include<fstream.h>   
ifstream f("fact.in");   
ofstream g("fact.out");   
long long p,nr,x,q=0;   
int main()   
{f>>p;   
 while(q<p)   
  {q++; nr+=5;   
   x=nr;   
   while(x)   
    {if(x%25==0)   
     q++; x/=5;   
    }      
  }     
 if(q==p) g<<nr;   
  else g<<-1;   
 return 0;      
}  
#include<iostream.h>
#include<fstream.h>
ifstream f("fact.in");
ofstream g("fact.out");
long long p,nr,x,q=0;
int main()
{f>>p; q=p;
 while(q>0)
  {q--; nr+=5;
   x=nr;
   while(x)
    {if(x%25==0)
     q--; x/=5;
    }   
  }  
 if(q==0) g<<nr;
  else g<<-1;
 return 0;   
}