Cod sursa(job #137133)

Utilizator DraStiKDragos Oprica DraStiK Data 16 februarie 2008 23:03:03
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include <stdio.h>
#include <math.h>
long n,p;
int main ()
{
    freopen ("fact.in","r",stdin);
	freopen ("fact.out","w",stdout);
	float i;
	int j,k;
	scanf ("%ld",&p);
	if (p==0)
	{
	   printf ("1");return 0;

	}
	n=p*5;
	i=sqrt(n);
	j=(int)i;
	j/=5;
	k=(j*(j+1))/2;
	k*=5;
	n-=k;
    printf ("%ld",n);
    return 0;
}