#include <stdio.h>
double sum (int x, int n);
int main ()
{
int x,n;
double res;
scanf("%d %d",&x,&n);
res=sum(x,n);
printf("%.3lf",res);
return 0;
}
double sum (int x, int n)
{
int i,j;
double s=1,f,p;
for(i=2;i<=n;i+=2)
{
f=1;
p=1;
for(j=0;j<i;j++)
{
p=p*2;
}
for(j=1;j<=i;j++)
{
f=f*j;
}
s=s+(p/f);
}
return s;
}
No comments:
Post a Comment