您的位置:首页 > 其它

HDU 2009 求数列的和

2011-06-13 22:32 351 查看
GCC编译 连接<math.h>要加参数 -lm

#include <stdio.h>
#include <math.h>
int main()
{
double n,m;
double ans;
while( scanf("%lf%lf",&n,&m)!=EOF )
{
ans = 0;
for(;m>0;m--)
{
ans += n;
n = sqrt(n);
}
printf("%.2f/n",ans);
}
return 0;
}
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  math.h gcc