求助!
  • 板块B2147 求 f(x,n)
  • 楼主XXY2022
  • 当前回复4
  • 已保存回复4
  • 发布时间2022/11/28 18:59
  • 上次更新2023/10/27 01:04:57
查看原帖
求助!
752252
XXY2022楼主2022/11/28 18:59
#include<iostream>
#include<cstdio>
using namespace std;
double f(int x,int n)
{
	if(n==1)
	{
		return x+1;
	}
	return x*1.0/(n+f(x,n-1));
}
int main()
{
    int x,n;
    cin>>x>>n;
    printf("%.2f",f(x,n));
    return 0;
}
2022/11/28 18:59
加载中...