【题目描述】
【输入】
【输出】
【输入样例】
1 2
【输出样例】
0.40
#include<iostream> #include<cmath> using namespace std; double x; int n; double f(double x,int n){//返回型递归,函数须return if(n==1)return x/(1+x); return x/( n + f(x,n-1) ); } int main() { cin>>x>>n; printf("%.2f",f(x,n)); return 0; }//OK
Powered by 孙会中 @ 2024-2026【 www.sunhuizhong.cn 】All rights reserved
访问统计:387660 本月:27 上月:1061 今日:6 昨日:3 当前在线:1人