#include<stdio.h>
#include<math.h>
main()
{
double m,n,i,k,g,w,cosx,e,x,h;
m=0;
w=1;
n=1;
i=0;
cosx=0;
printf("输入e x");
scanf("%lf%lf",&e,&x);
while (fabs(i)>=e)
{
m=m+2;
for(k=1;k<=m;k++)
w=k*w;
n=-n;
h=pow(x,m);
g=n*h;
i=g/w;
cosx=cosx+i;
}
printf("%lf",cosx);
return 0;
}