【题目描述】
【输入】
【输出】
【输入样例】
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
访问统计:386183 本月:281 上月:799 今日:7 昨日:6 当前在线:1人