f(n,x)

 1 #include <iostream>
 2 #include <cmath>
 3 using namespace std;
 4 int main(){
 5     double x,n,h=0.0;
 6     cin>>x>>n;
 7     for(int i=1;i<=n;i++){
 8         if(i==1){
 9             h=sqrt(1+x);
10         }else{
11             h=sqrt(i+h);
12         }
13     }
14     printf("%.2lf",h);
15     return 0;
16 }

 

posted @ 2024-03-30 08:58  -刘佳兴-  阅读(3)  评论(0编辑  收藏  举报