题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2009
//C++代码
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main(){
int n,m;
while(cin>>n>>m){
double sum=0,t=n;
while(m--){
sum+=t;
t=sqrt(t);
}
cout<<fixed<<setprecision(2)<<sum<<endl;
}
return 0;
}
本文介绍了一段使用C++解决数学问题的代码,通过循环和平方根运算实现求和功能,展示了C++在数学计算领域的应用。
334

被折叠的 条评论
为什么被折叠?



