1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        hdu 2009 求數(shù)列的和

        共 735字,需瀏覽 2分鐘

         ·

        2021-05-14 19:55

        求數(shù)列的和

        Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
        Total Submission(s): 152830    Accepted Submission(s): 90671


        Problem Description

        數(shù)列的定義如下:
        數(shù)列的第一項為n,以后各項為前一項的平方根,求數(shù)列的前m項的和。

         


        Input

        輸入數(shù)據(jù)有多組,每組占一行,由兩個整數(shù)n(n<10000)和m(m<1000)組成,n和m的含義如前所述。

         


        Output

        對于每組輸入數(shù)據(jù),輸出該數(shù)列的和,每個測試實例占一行,要求精度保留2位小數(shù)。

         


        Sample Input

        81 4
        2 2

         


        Sample Output

        94.73
        3.41



        代碼:

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


        瀏覽 34
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            特级西西大胆高清人体 | 性少妇videosexfree× | 老年一级片 | 四虎午夜影院 | 一本一道久久综合狠狠 | 亚洲国产专区 | 丁香五婷 | 巨人黑人videos精品性 | 内涵av入口 | 成人欧美一区二区三区黑人一 |