求数列的和

#include<stdio.h>
#include<math.h>
int main( )
{
  int N,M,i;
  while(scanf("%d%d",&N,&M)!=EOF)
  {
   double sum=0,p=N;
   for(i=0;i<M;i++)
   sum+=p,p=sqrt(p);
   printf("%.2lf\n",sum);
  }
  return 0;
}

posted on 2011-04-28 12:32  more think, more gains  阅读(121)  评论(0编辑  收藏  举报

导航