Guest
Login
跳过导航链接

级数求和
Time Limit:1000MS  Memory Limit:32768K

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

Sample Output:

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

Source:

qianneng
Submit Your Solution


Zhe Jiang University Of Technology Online Programming Space Beta1.3
Designed & Developped By Jin Qiwei
 All Copyright Reserved 2006
531