Cod sursa(job #36068)

Utilizator RobytzzaIonescu Robert Marius Robytzza Data 22 martie 2007 22:07:04
Problema Factorial Scor 55
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.33 kb
#include<fstream.h>
int main(){
ifstream fin("fact.in");
ofstream fout("fact.out");
int P,nr,x=0,N=0;
fin>>P;
if (P==0)
   fout<<1;
else
while (N!=P){
      x+=5;
      nr=x;
      while (nr%25==0){
	    nr/=5;
	    N++;}
      N++;
      }
if (P<0)
    x=-1;
fout<<x;
fin.close();
fout.close();
return 0;
}