求f(x,n)

w6826301 / 2023-08-02 / 原文

#include<iostream>
#include<cmath>
#include <bits/stdc++.h>
using namespace std;
double a(double n,double x){
    if(n==0){
        return x;
    }else{
        return sqrt(n+a(n-1,x));
    } 
}
int main(){
    double x,n,y;
    cin>>x>>n;
    y=a(n,x);
    cout<<fixed<<setprecision(2)<<y;
    return 0;
}