1180 级数求和


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

求下列级数的和: 1 + x - x^2/2! + x^3/3! - ... (-1)^(n+1)*x^n/n!

Input

输入数据含有不多于50个的浮点数x(0.0≤x≤5.0)

Output

对于每个x,输出其级数和,所有绝对值小于10的-6次方的数值不应加入级数和中,每个x的计算结果应占单独一行。其格式见样本输出。

Sample

Input

2.1 3.2

Output

x=2.100000, sum=1.877544
x=3.200000, sum=1.959238

Source: qianneng


Comments

There are no comments at the moment.