Cod sursa(job #246959)

Utilizator Soimul_NegruIon Popescu Soimul_Negru Data 21 ianuarie 2009 22:06:17
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <iostream.h>
#include <stdio.h>
int main()
{int j,x=0,i;
long p,n=0;

freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
cin>>p;

if(p==0) {cout<<1; return 0;}
else
 {while(x<p)
   {++x;
    n=n+5;
    if(n==25) ++x;
     if(n==125) ++x;
      if(n==625) ++x;
       if(n==3125) ++x;
	if(n==15625) ++x;
	 if(n==78125) ++x;
	  if(n==390625) ++x;
	   if(n==1953125) ++x;
	    if(n==9765625) ++x;
	     if(n==48828125) ++x;
	      if(n==244140625) ++x;
	       if(n==1220703125) ++x;}
  if(x==p) cout<<n;
  else cout<<-1;}

fcloseall();
return 0;
}