题目链接:
https://acm.hdu.edu.cn/showproblem.php?pid=2009
#include <stdio.h>
#include <math.h>
int main()
{
int n,m,i;
double sum;
while(scanf("%d %d",&n,&m)!=EOF)
{
sum=n;
for(int i=1;i<m;i++)
{
n=sqrt(n);//以后各项为前一项的平方根
sum+=n;
}
printf("%.2lf\n",sum);
}
return 0;
}
运行结果: