递推 hdu 1330
http://www.cnblogs.com/rainydays/archive/2013/01/16/2862235.html
看样例的答案
#include<stdio.h> #include<string.h> #include<algorithm> #include<math.h> using namespace std; typedef long long ll; #define MAXN 100010 double z[MAXN]; int main() { z[1]=0.5; for(int i=2;i<MAXN;i++) z[i]=z[i-1]+1.0/(i*2); int n; printf("# Cards Overhang\n"); while(scanf("%d",&n)!=EOF) { printf("%5d%10.3lf\n",n,z[n]); } return 0; }
posted on 2017-01-02 13:29 HelloWorld!--By-MJY 阅读(123) 评论(0) 编辑 收藏 举报