标签:sso 1.0 center style include 函数 递归 pid 输出
已知
用递归函数求解。
第一数是x的值,第二个数是n的值。
函数值。
1 2
0.40
#include <iostream> #include<stdio.h> #include<math.h> using namespace std; double h(int x,int n){ if(n==1) return 1.0*x/(1+x); return 1.0*x/(n+h(x,n-1)); } int main(){ double x,n; cin>>x>>n; printf("%.2f",h(x,n)); }
标签:sso 1.0 center style include 函数 递归 pid 输出
原文地址:http://www.cnblogs.com/EdSheeran/p/7327032.html