happystone

niuniu

pku 1517

 1//http://acm.pku.edu.cn/JudgeOnline/problem?id=1517
 2#include<iostream>
 3using namespace std;
 4int jiecheng(int n)
 5{
 6    if(n==0||n==1)
 7    return 1;
 8    else
 9    return n*jiecheng(n-1);
10    }

11int main()
12{
13    int i;
14    double a=1.0,b=0.0;
15    printf("n e\n");
16    printf("- -----------\n");
17    for(i=0;i<=9;i++){
18    a=1.0/jiecheng(i);
19    b+=a;
20    printf("%d %.10g\n",i,b);//g与f 
21    }

22    system("pause");
23    return 0;    
24    }

25

posted on 2010-08-09 22:12 玉中石 阅读(148) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理