Author: Administrator

double dist( double x1, double y1, double x2, double y2 ){
	double y;
	y=(y2-y1)*(y2-y1)+(x2-x1)*(x2-x1);
	return sqrt(y);	
}

int sign( int x ){
	int y;
	if(x>0)y=1;
	else if(x==0)y=0;
	else y=-1;
	return y; 
}

int sign( int x ){
	int y;
	if(x>0)return 1;
	else if(x==0)return 0;
	else return -1;
}

double fact( int n ){
	int t=1,i;
	for(i=1;i<=n;i++)
		t=t*i;
	return t; 
}

int prime( int p ){
	int i;
	if(p<2)return 0;
	int k=sqrt(p);
	for(i=2;i<=k;i++){
		if(p%i==0)return 0;
	}
	return 1;
}
int PrimeSum( int m, int n ){
	int i,sum=0;
	for(i=m;i<=n;i++){
		if(prime(i))sum+=i;
	}
	return sum;
}

void pyramid( int n ){
	//输出 “空”
	int i,j;
	for(i=1;i<=n;i++){
		for(j=1;j<=n-i;j++)printf(" ");
		for(j=1;j<=i;j++)printf("%d ",i);
		printf("\n");
	}		
}

void complex_prod( double x1, double y1, double x2, double y2 ){
	result_real=x1*x2-y1*y2;
	result_imag=x1*y2+x2*y1;	
}

int gcd( int x, int y ){
	
	if(x>y){
		int t;
		t=x,x=y,y=t;	
	}
	for(int i=x;i>=1;i--){
		if(x%i==0 && y%i==0)return i;
	}
}

int CountDigit( int number, int digit ){
	int k=0;
	if(number<0)number=-number;
	if(number==0 && digit==0)return 1;
	while(number){
		if(digit==number%10)k++;
		number=number/10;
	}
	return k;
}

double funcos( double e, double x ){
	double sum=0;
	double item=1,f=1,xx=1,t=1,k=0;
	while(item>=e){
		sum+=f*item;
		f=-f;
		xx=xx*x*x;
		t=t*(k+1)*(k+2);
		k=k+2;
		item=xx/t;
	}
	sum=sum+f*item;
	return sum;
	
}

#include <stdio.h>
#include <math.h>

double funcos( double e, double x );

int main()
{    
    double e, x;

    scanf("%lf %lf", &e, &x);
    printf("cos(%.2f) = %.6f\n", x, funcos(e, x));
    
    return 0;
}

/* 你的代码将被嵌在这里 */
double funcos( double e, double x ){
	double sum=0;
	double item=1,f=1,xx=1,t=1,k=0;
	while(item>=e){
		sum+=f*item;
		f=-f;
		xx=xx*x*x;
		t=t*(k+1)*(k+2);
		k=k+2;
		item=xx/t;
	}
	sum=sum+f*item;//加上最后一项 
	return sum;
	
}

int pp(int x,int k){
	int sum=1;
	for(int i=1;i<=k;i++)sum*=x;
	return sum;
}
int narcissistic( int number ){
	int k=0,sum=0;
	int num1=number,num2=number;
	while(num1) {
		k++;
		num1=num1/10;
	}
	int kk=k;
	while(kk--){
		sum+=pp(num2%10,k);
		num2=num2/10;
	}
	return sum==number;	
} 

void PrintN( int m, int n ){
	for(int i=m+1;i<=n-1;i++){
		if(narcissistic(i)){
			printf("%d\n",i);
		}
	}	
}